core: use error wrapping to provide more details
This commit is contained in:
parent
5ef08f60ae
commit
205f52c563
4 changed files with 18 additions and 18 deletions
|
@ -917,8 +917,8 @@ func (s *Server) submitBlock(reqParams request.Params) (interface{}, *response.E
|
|||
}
|
||||
err = s.chain.AddBlock(b)
|
||||
if err != nil {
|
||||
switch err {
|
||||
case core.ErrInvalidBlockIndex, core.ErrAlreadyExists:
|
||||
switch {
|
||||
case errors.Is(err, core.ErrInvalidBlockIndex) || errors.Is(err, core.ErrAlreadyExists):
|
||||
return nil, response.ErrAlreadyExists
|
||||
default:
|
||||
return nil, response.ErrValidationFailed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue