-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
38 lines (34 loc) · 947 Bytes
/
errors.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 gobdgz
const (
ErrorParse = -32700 // Parse error
ErrorInvalidRequest = -32600 // Invalid request
ErrorMethodNotFound = -32601 // Method not found
ErrorInvalidParams = -32602 // Invalid params
ErrorServerError = -32000 // Server error
)
const (
ErrorParseText = "Parse error"
ErrorInvalidRequestText = "Invalid request"
ErrorMethodNotFoundText = "Method not found"
ErrorInvalidParamsText = "Invalid params"
ErrorServerErrorText = "Server error"
)
const (
ErrorHTTP401 = "Unauthorized access"
ErrorHTTP403 = "Resource forbidden"
ErrorHTTP405 = "Method not allowed"
ErrorHTTP429 = "Too many requests"
)
type ResponseError struct {
ID *string `json:"id"`
JSONRPC string `json:"jsonrpc"`
Error Error `json:"error"`
}
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data Data `json:"data"`
}
type Data struct {
Details string `json:"details"`
}