Class JsonRpcException

All Implemented Interfaces:
Serializable

public final class JsonRpcException extends RuntimeException
Exception thrown when a JSON-RPC error occurs during communication with the Copilot CLI server.

This exception wraps error responses from the JSON-RPC protocol, including the error code, message, and optional raw JSON data returned by the server. Calls to CompletableFuture.get() wrap this exception in an ExecutionException; calls to CompletableFuture.join() wrap it in a CompletionException.

Since:
1.0.15-preview.1
See Also:
  • Constructor Details

    • JsonRpcException

      public JsonRpcException(int code, String message)
      Creates a new JSON-RPC exception.
      Parameters:
      code - the JSON-RPC error code
      message - the error message from the server
    • JsonRpcException

      public JsonRpcException(int code, String message, com.fasterxml.jackson.databind.JsonNode data)
      Creates a new JSON-RPC exception with optional raw JSON error data.
      Parameters:
      code - the JSON-RPC error code
      message - the error message from the server
      data - the error data, or null if omitted; a JSON null is represented by a NullNode
      Since:
      1.0.15-preview.1
  • Method Details

    • getCode

      public int getCode()
      Returns the JSON-RPC error code.

      Standard JSON-RPC error codes include:

      • -32700: Parse error
      • -32600: Invalid request
      • -32601: Method not found
      • -32602: Invalid params
      • -32603: Internal error
      Returns:
      the error code
    • getData

      public com.fasterxml.jackson.databind.JsonNode getData()
      Returns the raw JSON error data without converting its value or shape.

      An omitted data member is represented by Java null. An explicit JSON null is represented by a NullNode. This value is not included in the exception's message or string representation. The node is shared, not defensively copied; callers that modify container nodes should first use JsonNode.deepCopy().

      Returns:
      the error data, or null if the server omitted it
      Since:
      1.0.15-preview.1