Unify error handling of GetTransactionSpecific #395

go1.15
Martin Boehm 2020-11-28 15:27:05 +01:00
parent a1e932a902
commit 9876a463a3
1 changed files with 3 additions and 0 deletions

View File

@ -975,6 +975,9 @@ func (s *PublicServer) apiTxSpecific(r *http.Request, apiVersion int) (interface
var err error
s.metrics.ExplorerViews.With(common.Labels{"action": "api-tx-specific"}).Inc()
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
}