mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-486] API Server TX posting: Forward error when RPC Error is received (#507)
* [NOD-486] Forward error when RPC Error is recieved * [NOD-486] Rename variable * [NOD-486] Rename variable * [NOD-486] Rename Variable (again)
This commit is contained in:
parent
bb7d68deda
commit
1fea2a9421
@ -278,12 +278,13 @@ func PostTransaction(requestBody []byte) error {
|
||||
|
||||
_, err = client.SendRawTransaction(tx, true)
|
||||
if err != nil {
|
||||
if rpcErr, ok := err.(*btcjson.RPCError); ok && rpcErr.Code == btcjson.ErrRPCVerify {
|
||||
return httpserverutils.NewHandlerError(http.StatusInternalServerError, err)
|
||||
switch err := errors.Cause(err).(type) {
|
||||
case *btcjson.RPCError:
|
||||
return httpserverutils.NewHandlerError(http.StatusUnprocessableEntity, err)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user