|
@ -111,6 +111,11 @@ func (r ResponseCheckTx) IsErr() bool { |
|
|
return r.Code != CodeType_OK |
|
|
return r.Code != CodeType_OK |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Error implements error interface by formatting response as string.
|
|
|
|
|
|
func (r ResponseCheckTx) Error() string { |
|
|
|
|
|
return fmtError(r.Code, r.Log) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Convert ResponseDeliverTx to standard Result
|
|
|
// Convert ResponseDeliverTx to standard Result
|
|
|
func (r *ResponseDeliverTx) Result() Result { |
|
|
func (r *ResponseDeliverTx) Result() Result { |
|
|
return Result{ |
|
|
return Result{ |
|
@ -126,6 +131,11 @@ func (r ResponseDeliverTx) IsErr() bool { |
|
|
return r.Code != CodeType_OK |
|
|
return r.Code != CodeType_OK |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Error implements error interface by formatting response as string.
|
|
|
|
|
|
func (r ResponseDeliverTx) Error() string { |
|
|
|
|
|
return fmtError(r.Code, r.Log) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
type ResultQuery struct { |
|
|
type ResultQuery struct { |
|
|
Code CodeType `json:"code"` |
|
|
Code CodeType `json:"code"` |
|
|
Index int64 `json:"index"` |
|
|
Index int64 `json:"index"` |
|
@ -152,3 +162,17 @@ func (r *ResponseQuery) Result() *ResultQuery { |
|
|
func (r ResponseCommit) IsErr() bool { |
|
|
func (r ResponseCommit) IsErr() bool { |
|
|
return r.Code != CodeType_OK |
|
|
return r.Code != CodeType_OK |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Error implements error interface by formatting response as string.
|
|
|
|
|
|
func (r ResponseCommit) Error() string { |
|
|
|
|
|
return fmtError(r.Code, r.Log) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func fmtError(code CodeType, log string) string { |
|
|
|
|
|
codeAsStr, ok := code2string[code] |
|
|
|
|
|
if ok { |
|
|
|
|
|
return fmt.Sprintf("%s (%v): %s", codeAsStr, code, log) |
|
|
|
|
|
} else { |
|
|
|
|
|
return fmt.Sprintf("Unknown error (%v): %s", code, log) |
|
|
|
|
|
} |
|
|
|
|
|
} |