-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
51 lines (47 loc) · 1.71 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
package fireblocksdk
var errorCodes = map[int]string{
1000: "GET_VAULT_ACCOUNTS_INVALID_PARAMS",
1001: "GET_VAULT_ACCOUNTS_UNEXPECTED_ERROR",
1002: "POST_VAULT_ACCOUNTS_INVALID_PARAMS",
1003: "POST_VAULT_ACCOUNTS_UNEXPECTED_ERROR",
1004: "GET_VAULT_ACCOUNT_BY_ID_NOT_FOUND",
1005: "GET_VAULT_ACCOUNT_BY_ID_UNEXPECTED_ERROR",
1006: "GET_VAULT_ASSET_FAILED_NOT_FOUND",
1007: "GET_VAULT_ASSET_FAILED_UNEXPECTED_ERROR",
1008: "CREATE_VAULT_ASSET_FAILED_INVALID_PARAMS",
1009: "CREATE_VAULT_ASSET_FAILED_UNEXPECTED_ERROR",
1010: "CREATE_VAULT_ASSET_ADDRESS_FAILED_INVALID_PARAMS",
1011: "CREATE_VAULT_ASSET_ADDRESS_FAILED_UNEXPECTED_ERROR",
1012: "GET_VAULT_ASSET_ADDRESS_FAILED_UNEXPECTED_ERROR",
1013: "PUT_VAULT_ACCOUNTS_INVALID_PARAMS",
1014: "PUT_VAULT_ACCOUNTS_UNEXPECTED_ERROR",
1015: "PUT_ADDRESS_ID_INVALID_PARAMS",
1016: "PUT_ADDRESS_ID_UNEXPECTED_ERROR",
1017: "HIDE_VAULT_ACCOUNT_NOT_FOUND",
1018: "HIDE_VAULT_ACCOUNT_SEND_FAILED",
1019: "HIDE_VAULT_ACCOUNT_INVALID_PARAMS",
1020: "UNHIDE_VAULT_ACCOUNT_NOT_FOUND",
1021: "UNHIDE_VAULT_ACCOUNT_SEND_FAILED",
1022: "UNHIDE_VAULT_ACCOUNT_INVALID_PARAMS",
1025: "CREATE_VAULT_ASSET_UNSUPPORTED_ERROR",
1026: "CREATE_VAULT_ASSET_NOT_ALLOWED_ERROR",
1027: "MAX_SPENDABLE_AMOUNT_ASSET_NOT_ALLOWED_ERROR",
1028: "MAX_SPENDABLE_AMOUNT_INVALID_PARAMETERS",
1029: "MAX_SPENDABLE_AMOUNT_INTERNAL_ERROR",
1030: "MAX_SPENDABLE_AMOUNT_UNEXPECTED_ERROR",
}
type sdkError struct {
Code int `json:"code,omitempty"`
Path string `json:"path,omitempty"`
Message string `json:"message,omitempty"`
}
func (e sdkError) Error() string {
return e.Message
}
func (e sdkError) GetTextCode() string {
code, ok := errorCodes[e.Code]
if !ok {
return e.Message
}
return code
}