Unify error handling of GetTransactionSpecific #395
parent
a1e932a902
commit
9876a463a3
|
@ -975,6 +975,9 @@ func (s *PublicServer) apiTxSpecific(r *http.Request, apiVersion int) (interface
|
||||||
var err error
|
var err error
|
||||||
s.metrics.ExplorerViews.With(common.Labels{"action": "api-tx-specific"}).Inc()
|
s.metrics.ExplorerViews.With(common.Labels{"action": "api-tx-specific"}).Inc()
|
||||||
tx, err = s.chain.GetTransactionSpecific(&bchain.Tx{Txid: txid})
|
tx, err = s.chain.GetTransactionSpecific(&bchain.Tx{Txid: txid})
|
||||||
|
if err == bchain.ErrTxNotFound {
|
||||||
|
return nil, api.NewAPIError(fmt.Sprintf("Transaction '%v' not found", txid), true)
|
||||||
|
}
|
||||||
return tx, err
|
return tx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue