Improve get raw block not found handling
This commit is contained in:
parent
fad284a425
commit
673cdbc446
@ -1715,6 +1715,12 @@ func (w *Worker) GetBlockRaw(bid string) (*BlockRaw, error) {
|
|||||||
return nil, NewAPIError("Block not found", true)
|
return nil, NewAPIError("Block not found", true)
|
||||||
}
|
}
|
||||||
hex, err := w.chain.GetBlockRaw(hash)
|
hex, err := w.chain.GetBlockRaw(hash)
|
||||||
|
if err != nil {
|
||||||
|
if err == bchain.ErrBlockNotFound {
|
||||||
|
return nil, NewAPIError("Block not found", true)
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return &BlockRaw{Hex: hex}, err
|
return &BlockRaw{Hex: hex}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user