-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
33 lines (22 loc) · 1009 Bytes
/
errors.go
File metadata and controls
33 lines (22 loc) · 1009 Bytes
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
package jsoff
import ()
// error defination https://www.jsonrpc.org/specification#error_object
var (
ErrServerError = &RPCError{100, "server error", nil}
//ErrNilId = &RPCError{102, "nil message id", nil}
ErrMethodNotFound = &RPCError{-32601, "method not found", nil}
ErrEmptyMethod = &RPCError{-32601, "empty method", nil}
ErrParseMessage = &RPCError{-32700, "parse error", nil}
ErrInvalidRequest = &RPCError{-32600, "invalid request", nil}
ErrInternalError = &RPCError{-32603, "internal error", nil}
ErrMessageType = &RPCError{105, "wrong message type", nil}
ErrTimeout = &RPCError{200, "request timeout", nil}
ErrBadResource = &RPCError{201, "bad resource", nil}
ErrLiveExit = &RPCError{202, "live exit", nil}
ErrNotAllowed = &RPCError{406, "type not allowed", nil}
ErrAuthFailed = &RPCError{401, "auth failed", nil}
ErrInvalidSchema = &RPCError{-32633, "invalid schema", nil}
)
func ParamsError(message string) *RPCError {
return &RPCError{-32602, message, nil}
}