From 5a8bc49c22fb1bb37fec98f9aea86f9e9d0dc2b8 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Fri, 21 Aug 2020 13:43:15 +0100 Subject: [PATCH] Unique error for fee broadcast failure --- webapi/errors.go | 5 +++++ webapi/payfee.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/webapi/errors.go b/webapi/errors.go index eca944d..bf334e5 100644 --- a/webapi/errors.go +++ b/webapi/errors.go @@ -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" } diff --git a/webapi/payfee.go b/webapi/payfee.go index b01a50c..ef6bdf0 100644 --- a/webapi/payfee.go +++ b/webapi/payfee.go @@ -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 }