mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-06 06:58:39 +00:00
Merge c471e3c571 into 1bdc4a60d9
This commit is contained in:
commit
2199517a7c
1 changed files with 5 additions and 4 deletions
|
|
@ -126,11 +126,12 @@ func errorMessage(err error) *jsonrpcMessage {
|
||||||
Code: errcodeDefault,
|
Code: errcodeDefault,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}}
|
}}
|
||||||
ec, ok := err.(Error)
|
var rpcError Error
|
||||||
if ok {
|
if errors.As(err, &rpcError) {
|
||||||
msg.Error.Code = ec.ErrorCode()
|
msg.Error.Code = rpcError.ErrorCode()
|
||||||
}
|
}
|
||||||
de, ok := err.(DataError)
|
// Type assert on rpcError to ensure that both code and data come from the same error object.
|
||||||
|
de, ok := rpcError.(DataError)
|
||||||
if ok {
|
if ok {
|
||||||
msg.Error.Data = de.ErrorData()
|
msg.Error.Data = de.ErrorData()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue