commit 9fe3018e88fa1222d169c0408f5614ab4ce7f72d
parent 07cc75f2055ba4ae77d8272ea2cedffbb54b6842
Author: Florian Dold <florian.dold@gmail.com>
Date: Wed, 31 Jan 2018 19:15:05 +0100
nicer error messages for /tip-authorize
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/backend/taler-merchant-httpd_tip-authorize.c b/src/backend/taler-merchant-httpd_tip-authorize.c
@@ -395,26 +395,31 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
if (TALER_EC_NONE != ec)
{
unsigned int rc;
+ const char *msg;
switch (ec)
{
case TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS:
rc = MHD_HTTP_PRECONDITION_FAILED;
+ msg = "Failed to approve tip: merchant has insufficient tipping funds";
break;
case TALER_EC_TIP_AUTHORIZE_RESERVE_EXPIRED:
+ msg = "Failed to approve tip: merchant's tipping reserve expired";
rc = MHD_HTTP_PRECONDITION_FAILED;
break;
case TALER_EC_TIP_AUTHORIZE_RESERVE_UNKNOWN:
+ msg = "Failed to approve tip: merchant's tipping reserve does not exist";
rc = MHD_HTTP_NOT_FOUND;
break;
default:
rc = MHD_HTTP_INTERNAL_SERVER_ERROR;
+ msg = "Failed to approve tip: internal server error";
break;
}
return TMH_RESPONSE_reply_rc (connection,
rc,
ec,
- "Database error approving tip");
+ msg);
}
/* generate success response */