-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathJsonRpcException.java
More file actions
48 lines (43 loc) · 1.33 KB
/
JsonRpcException.java
File metadata and controls
48 lines (43 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk;
/**
* Exception thrown when a JSON-RPC error occurs during communication with the
* Copilot CLI server.
* <p>
* This exception wraps error responses from the JSON-RPC protocol, including
* the error code and message returned by the server.
*/
final class JsonRpcException extends RuntimeException {
private final int code;
/**
* Creates a new JSON-RPC exception.
*
* @param code
* the JSON-RPC error code
* @param message
* the error message from the server
*/
public JsonRpcException(int code, String message) {
super(message);
this.code = code;
}
/**
* Returns the JSON-RPC error code.
* <p>
* Standard JSON-RPC error codes include:
* <ul>
* <li>-32700: Parse error</li>
* <li>-32600: Invalid request</li>
* <li>-32601: Method not found</li>
* <li>-32602: Invalid params</li>
* <li>-32603: Internal error</li>
* </ul>
*
* @return the error code
*/
public int getCode() {
return code;
}
}