-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPCErrorInfo.go
38 lines (31 loc) · 1.11 KB
/
RPCErrorInfo.go
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
package wsrpc
// RPCErrorInfo represents an RPC error that provides error code and message information.
// This type implements error
type RPCErrorInfo struct {
Code int32 `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
// RPCInvalidRequestError represents that the JSON sent is not a valid Request object.
var RPCInvalidRequestError = RPCErrorInfo{
Code: -32600,
Message: "Invalid Request"}
// RPCMothedNotFoundError represents an error that method is not found.
var RPCMothedNotFoundError = RPCErrorInfo{
Code: -32601,
Message: "Method not found"}
// RPCInvalidParamsError represents an error that params are invalid.
var RPCInvalidParamsError = RPCErrorInfo{
Code: -32602,
Message: "Invalid params"}
// RPCInternalError represents an internal error.
var RPCInternalError = RPCErrorInfo{
Code: -32603,
Message: "Internal error"}
// RPCParseError represents that an error occurred while parsing the JSON text.
var RPCParseError = RPCErrorInfo{
Code: -32700,
Message: "Parse error"}
func (err RPCErrorInfo) Error() string {
return err.Message
}