forked from btcsuite/btcjson
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjsonerr.go
171 lines (164 loc) · 3.71 KB
/
jsonerr.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package flojson
// Standard JSON-RPC 2.0 errors
var (
ErrInvalidRequest = Error{
Code: -32600,
Message: "Invalid request",
}
ErrMethodNotFound = Error{
Code: -32601,
Message: "Method not found",
}
ErrInvalidParams = Error{
Code: -32602,
Message: "Invalid paramaters",
}
ErrInternal = Error{
Code: -32603,
Message: "Internal error",
}
ErrParse = Error{
Code: -32700,
Message: "Parse error",
}
)
// General application defined JSON errors
var (
ErrMisc = Error{
Code: -1,
Message: "Miscellaneous error",
}
ErrForbiddenBySafeMode = Error{
Code: -2,
Message: "Server is in safe mode, and command is not allowed in safe mode",
}
ErrType = Error{
Code: -3,
Message: "Unexpected type was passed as parameter",
}
ErrInvalidAddressOrKey = Error{
Code: -5,
Message: "Invalid address or key",
}
ErrOutOfMemory = Error{
Code: -7,
Message: "Ran out of memory during operation",
}
ErrInvalidParameter = Error{
Code: -8,
Message: "Invalid, missing or duplicate parameter",
}
ErrDatabase = Error{
Code: -20,
Message: "Database error",
}
ErrDeserialization = Error{
Code: -22,
Message: "Error parsing or validating structure in raw format",
}
)
// Peer-to-peer client errors
var (
ErrClientNotConnected = Error{
Code: -9,
Message: "Bitcoin is not connected",
}
ErrClientInInitialDownload = Error{
Code: -10,
Message: "Bitcoin is downloading blocks...",
}
)
// Wallet JSON errors
var (
ErrWallet = Error{
Code: -4,
Message: "Unspecified problem with wallet",
}
ErrWalletInsufficientFunds = Error{
Code: -6,
Message: "Not enough funds in wallet or account",
}
ErrWalletInvalidAccountName = Error{
Code: -11,
Message: "Invalid account name",
}
ErrWalletKeypoolRanOut = Error{
Code: -12,
Message: "Keypool ran out, call keypoolrefill first",
}
ErrWalletUnlockNeeded = Error{
Code: -13,
Message: "Enter the wallet passphrase with walletpassphrase first",
}
ErrWalletPassphraseIncorrect = Error{
Code: -14,
Message: "The wallet passphrase entered was incorrect",
}
ErrWalletWrongEncState = Error{
Code: -15,
Message: "Command given in wrong wallet encryption state",
}
ErrWalletEncryptionFailed = Error{
Code: -16,
Message: "Failed to encrypt the wallet",
}
ErrWalletAlreadyUnlocked = Error{
Code: -17,
Message: "Wallet is already unlocked",
}
)
// Specific Errors related to commands. These are the ones a user of the rpc
// server are most likely to see. Generally, the codes should match one of the
// more general errors above.
var (
ErrBlockNotFound = Error{
Code: -5,
Message: "Block not found",
}
ErrBlockCount = Error{
Code: -5,
Message: "Error getting block count",
}
ErrBestBlockHash = Error{
Code: -5,
Message: "Error getting best block hash",
}
ErrDifficulty = Error{
Code: -5,
Message: "Error getting difficulty",
}
ErrOutOfRange = Error{
Code: -1,
Message: "Block number out of range",
}
ErrNoTxInfo = Error{
Code: -5,
Message: "No information available about transaction",
}
ErrNoNewestBlockInfo = Error{
Code: -5,
Message: "No information about newest block",
}
ErrRawTxString = Error{
Code: -32602,
Message: "Raw tx is not a string",
}
ErrDecodeHexString = Error{
Code: -22,
Message: "Unable to decode hex string",
}
)
// Errors that are specific to btcd.
var (
ErrNoWallet = Error{
Code: -1,
Message: "This implementation does not implement wallet commands",
}
ErrUnimplemented = Error{
Code: -1,
Message: "Command unimplemented",
}
)