mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-25 09:19:28 +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,
|
||||
Message: err.Error(),
|
||||
}}
|
||||
ec, ok := err.(Error)
|
||||
if ok {
|
||||
msg.Error.Code = ec.ErrorCode()
|
||||
var rpcError Error
|
||||
if errors.As(err, &rpcError) {
|
||||
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 {
|
||||
msg.Error.Data = de.ErrorData()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue