aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-02-17 03:20:28 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-02-17 03:20:28 +0100
commit0d500cb4d5ed757ccdceabb3fe68d06442be8cf1 (patch)
tree141e6b657d4457e3fe015917da39c1190e8cbf23 /src
parent47993fae5431c150e03fdce586f8806b86e69b53 (diff)
better error handling for hash-contract, again
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd_contract.c4
-rw-r--r--src/backend/taler-merchant-httpd_util.c10
2 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_contract.c b/src/backend/taler-merchant-httpd_contract.c
index 167e8b08..064e10c5 100644
--- a/src/backend/taler-merchant-httpd_contract.c
+++ b/src/backend/taler-merchant-httpd_contract.c
@@ -93,7 +93,7 @@ MH_handler_contract (struct TMH_RequestHandler *rh,
if (NULL == jcontract)
{
- return TMH_RESPONSE_reply_internal_error (connection,
+ return TMH_RESPONSE_reply_external_error (connection,
"contract request malformed");
}
/* extract fields we need to sign separately */
@@ -103,7 +103,7 @@ MH_handler_contract (struct TMH_RequestHandler *rh,
if (GNUNET_NO == res)
return MHD_YES;
if (GNUNET_SYSERR == res)
- return TMH_RESPONSE_reply_internal_error (connection,
+ return TMH_RESPONSE_reply_external_error (connection,
"contract request malformed");
/* add fields to the contract that the backend should provide */
diff --git a/src/backend/taler-merchant-httpd_util.c b/src/backend/taler-merchant-httpd_util.c
index 9a500184..4c28290e 100644
--- a/src/backend/taler-merchant-httpd_util.c
+++ b/src/backend/taler-merchant-httpd_util.c
@@ -81,19 +81,15 @@ MH_handler_hash_contract (struct TMH_RequestHandler *rh,
if (NULL == jcontract)
{
- return TMH_RESPONSE_reply_internal_error (connection,
+ return TMH_RESPONSE_reply_external_error (connection,
"missing 'contract' field");
}
if (GNUNET_OK != TALER_hash_json (jcontract,
&hc))
{
- res = TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:s, s:s}",
- "error", "invalid contract",
- "hint", "expected object");
- return res;
+ return TMH_RESPONSE_reply_external_error (connection,
+ "expected object as contract");
}
GNUNET_assert (GNUNET_OK ==