summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-01-23 15:44:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2020-01-23 15:44:33 +0100
commit26c9563ef0719601dfd5ac33c70b277dde7e5326 (patch)
tree0f6ed3805ad022055cc8004b8a6c859ab561b3a6
parent0fe82acc1b7a57d53903624a5789ca83dfae2b45 (diff)
downloadexchange-26c9563ef0719601dfd5ac33c70b277dde7e5326.tar.gz
exchange-26c9563ef0719601dfd5ac33c70b277dde7e5326.tar.bz2
exchange-26c9563ef0719601dfd5ac33c70b277dde7e5326.zip
return TALER_EC_INVALID instead of TALER_EC_NONE when error JSON doesn't contain code
-rw-r--r--src/json/json.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/json/json.c b/src/json/json.c
index 807ea0b61..6de299319 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -77,8 +77,13 @@ TALER_JSON_get_error_code (const json_t *json)
return TALER_EC_INVALID_RESPONSE;
}
jc = json_object_get (json, "code");
+ /* The caller already knows that the JSON represents an error,
+ so we are dealing with a missing error code here. */
if (NULL == jc)
- return TALER_EC_NONE;
+ {
+ GNUNET_break_op (0);
+ return TALER_EC_INVALID;
+ }
if (json_is_integer (jc))
return (enum TALER_ErrorCode) json_integer_value (jc);
GNUNET_break_op (0);