Skip to content

lspeasy / core/src / JSONRPCErrorCode

Variable: JSONRPCErrorCode

ts
const JSONRPCErrorCode: {
  ContentModified: -32801;
  InternalError: -32603;
  InvalidParams: -32602;
  InvalidRequest: -32600;
  MethodNotFound: -32601;
  ParseError: -32700;
  RequestCancelled: -32800;
  ServerCancelled: -32802;
  ServerErrorEnd: -32000;
  ServerErrorStart: -32099;
  ServerNotInitialized: -32002;
  UnknownErrorCode: -32001;
};

Defined in: packages/core/src/utils/errors.ts:19

Numeric error codes defined by JSON-RPC 2.0 and the LSP specification.

Type Declaration

NameTypeDefault valueDefined in
ContentModified-32801-32801packages/core/src/utils/errors.ts:35
InternalError-32603-32603packages/core/src/utils/errors.ts:25
InvalidParams-32602-32602packages/core/src/utils/errors.ts:24
InvalidRequest-32600-32600packages/core/src/utils/errors.ts:22
MethodNotFound-32601-32601packages/core/src/utils/errors.ts:23
ParseError-32700-32700packages/core/src/utils/errors.ts:21
RequestCancelled-32800-32800packages/core/src/utils/errors.ts:34
ServerCancelled-32802-32802packages/core/src/utils/errors.ts:36
ServerErrorEnd-32000-32000packages/core/src/utils/errors.ts:33
ServerErrorStart-32099-32099packages/core/src/utils/errors.ts:32
ServerNotInitialized-32002-32002packages/core/src/utils/errors.ts:28
UnknownErrorCode-32001-32001packages/core/src/utils/errors.ts:29

Remarks

Use these constants when throwing ResponseError from request handlers so clients can programmatically distinguish error types.

Ranges:

  • -32700 to -32600: JSON-RPC 2.0 standard errors
  • -32899 to -32800: LSP-reserved range
  • -32099 to -32000: Application-defined errors

Released under the MIT License.