mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-27 19:37:08 +00:00
remove types.Result
This commit is contained in:
@@ -1,3 +1,37 @@
|
||||
package types
|
||||
|
||||
var (
|
||||
code2string = map[CodeType]string{
|
||||
CodeType_InternalError: "Internal error",
|
||||
CodeType_EncodingError: "Encoding error",
|
||||
CodeType_BadNonce: "Error bad nonce",
|
||||
CodeType_Unauthorized: "Unauthorized",
|
||||
CodeType_InsufficientFunds: "Insufficient funds",
|
||||
CodeType_UnknownRequest: "Unknown request",
|
||||
|
||||
CodeType_BaseDuplicateAddress: "Error (base) duplicate address",
|
||||
CodeType_BaseEncodingError: "Error (base) encoding error",
|
||||
CodeType_BaseInsufficientFees: "Error (base) insufficient fees",
|
||||
CodeType_BaseInsufficientFunds: "Error (base) insufficient funds",
|
||||
CodeType_BaseInsufficientGasPrice: "Error (base) insufficient gas price",
|
||||
CodeType_BaseInvalidInput: "Error (base) invalid input",
|
||||
CodeType_BaseInvalidOutput: "Error (base) invalid output",
|
||||
CodeType_BaseInvalidPubKey: "Error (base) invalid pubkey",
|
||||
CodeType_BaseInvalidSequence: "Error (base) invalid sequence",
|
||||
CodeType_BaseInvalidSignature: "Error (base) invalid signature",
|
||||
CodeType_BaseUnknownAddress: "Error (base) unknown address",
|
||||
CodeType_BaseUnknownPlugin: "Error (base) unknown plugin",
|
||||
CodeType_BaseUnknownPubKey: "Error (base) unknown pubkey",
|
||||
}
|
||||
)
|
||||
|
||||
func (c CodeType) IsOK() bool { return c == CodeType_OK }
|
||||
|
||||
// HumanCode transforms code into a more humane format, such as "Internal error" instead of 0.
|
||||
func HumanCode(code CodeType) string {
|
||||
s, ok := code2string[code]
|
||||
if !ok {
|
||||
return "Unknown code"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user