Overview
TheRequestError class represents errors that occur during JSON-RPC method execution in ACP connections. It follows the JSON-RPC 2.0 error object specification and provides static factory methods for creating standard error types.
Constructor
code(number) - The JSON-RPC error codemessage(string) - Human-readable error messagedata(unknown, optional) - Additional error information
Properties
code
message
data
Static Factory Methods
parseError
-32700).
Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
Parameters:
data(unknown, optional) - Additional error dataadditionalMessage(string, optional) - Additional context to append to the error message
-32700
Example:
invalidRequest
-32600).
The JSON sent is not a valid Request object.
Parameters:
data(unknown, optional) - Additional error dataadditionalMessage(string, optional) - Additional context to append to the error message
-32600
Example:
methodNotFound
-32601).
The method does not exist or is not available.
Parameters:
method(string) - The method name that was not found
-32601 and the method name in data
Example:
invalidParams
-32602).
Invalid method parameter(s).
Parameters:
data(unknown, optional) - Additional error data (often validation details)additionalMessage(string, optional) - Additional context to append to the error message
-32602
Example:
internalError
-32603).
Internal JSON-RPC error.
Parameters:
data(unknown, optional) - Additional error dataadditionalMessage(string, optional) - Additional context to append to the error message
-32603
Example:
authRequired
-32000).
Parameters:
data(unknown, optional) - Additional error dataadditionalMessage(string, optional) - Additional context to append to the error message
-32000
Example:
resourceNotFound
-32002).
Resource, such as a file, was not found.
Parameters:
uri(string, optional) - The URI of the missing resource
-32002 and URI in data (if provided)
Example:
Instance Methods
toResult
toErrorResponse
Usage in Request Handlers
See Also
- Error Codes - Complete list of error codes
- JSON-RPC Types - JSON-RPC type definitions