Unique error for fee broadcast failure

This commit is contained in:
jholdstock 2020-08-21 13:43:15 +01:00 committed by David Hill
parent 8c428c769d
commit 5a8bc49c22
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ const (
errFeeNotReceived
errInvalidTicket
errCannotBroadcastTicket
errCannotBroadcastFee
)
// httpStatus maps application error codes to HTTP status codes.
@ -59,6 +60,8 @@ func (e apiError) httpStatus() int {
return http.StatusBadRequest
case errCannotBroadcastTicket:
return http.StatusInternalServerError
case errCannotBroadcastFee:
return http.StatusInternalServerError
default:
return http.StatusInternalServerError
}
@ -97,6 +100,8 @@ func (e apiError) defaultMessage() string {
return "not a valid ticket tx"
case errCannotBroadcastTicket:
return "ticket transaction could not be broadcast"
case errCannotBroadcastFee:
return "fee transaction could not be broadcast"
default:
return "unknown error"
}

View File

@ -239,7 +239,7 @@ findAddress:
funcName, ticket.Hash, err)
}
sendErrorWithMsg("could not broadcast fee transaction", errInvalidFeeTx, c)
sendErrorWithMsg("could not broadcast fee transaction", errCannotBroadcastFee, c)
return
}