mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
Use errors.As
This commit is contained in:
parent
aaa2b66285
commit
2c5136b794
1 changed files with 4 additions and 4 deletions
|
|
@ -126,12 +126,12 @@ func errorMessage(err error) *jsonrpcMessage {
|
|||
Code: errcodeDefault,
|
||||
Message: err.Error(),
|
||||
}}
|
||||
ec, ok := err.(Error)
|
||||
if ok {
|
||||
var ec Error
|
||||
if errors.As(err, &ec) {
|
||||
msg.Error.Code = ec.ErrorCode()
|
||||
}
|
||||
de, ok := err.(DataError)
|
||||
if ok {
|
||||
var de DataError
|
||||
if errors.As(err, &de) {
|
||||
msg.Error.Data = de.ErrorData()
|
||||
}
|
||||
return msg
|
||||
|
|
|
|||
Loading…
Reference in a new issue