diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-16 14:27:42 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-16 14:27:42 +0100 |
commit | 4bd515191b6db342ff465e0595cfeafe6da8a680 (patch) | |
tree | 982d32e7920dc86c1e7c20ac620dca3fea33e38a /src/mint/taler-mint-httpd_deposit.c | |
parent | f398b34414e3dbde31c0ec4b627aaa7ccf593ee0 (diff) | |
download | exchange-4bd515191b6db342ff465e0595cfeafe6da8a680.tar.gz exchange-4bd515191b6db342ff465e0595cfeafe6da8a680.tar.bz2 exchange-4bd515191b6db342ff465e0595cfeafe6da8a680.zip |
nicer TALER_MINT_parse_post_json return value handling, fixing return values where GNUNET_SYSERR is used instead of MHD_NO, marking cases where we should return a proper error message
Diffstat (limited to 'src/mint/taler-mint-httpd_deposit.c')
-rw-r--r-- | src/mint/taler-mint-httpd_deposit.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index f1df0ad89..d92dd5ef7 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c @@ -89,21 +89,19 @@ TALER_MINT_handler_deposit (struct RequestHandler *rh, int res; res = TALER_MINT_parse_post_json (connection, - connection_cls, - upload_data, upload_data_size, - &json); + connection_cls, + upload_data, + upload_data_size, + &json); if (GNUNET_SYSERR == res) - { - // FIXME: return 'internal error' - GNUNET_break (0); return MHD_NO; - } - if (GNUNET_NO == res) + if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; if (NULL == (db_conn = TALER_MINT_DB_get_connection ())) { + /* FIXME: return error message to client via MHD! */ GNUNET_break (0); - return GNUNET_SYSERR; + return MHD_NO; } deposit = NULL; @@ -213,7 +211,8 @@ TALER_MINT_handler_deposit (struct RequestHandler *rh, if (GNUNET_SYSERR == res) { GNUNET_break (0); - return GNUNET_SYSERR; + /* FIXME: return error message to client via MHD! */ + return MHD_NO; } } @@ -235,7 +234,8 @@ TALER_MINT_handler_deposit (struct RequestHandler *rh, if (GNUNET_SYSERR == res) { GNUNET_break (0); - return GNUNET_SYSERR; + /* FIXME: return error message to client via MHD! */ + return MHD_NO; } /* coin valid but not known => insert into DB */ @@ -246,14 +246,16 @@ TALER_MINT_handler_deposit (struct RequestHandler *rh, if (GNUNET_OK != TALER_MINT_DB_insert_known_coin (db_conn, &known_coin)) { GNUNET_break (0); - return GNUNET_SYSERR; + /* FIXME: return error message to client via MHD! */ + return MHD_NO; } } if (GNUNET_OK != TALER_MINT_DB_insert_deposit (db_conn, deposit)) { GNUNET_break (0); - return GNUNET_SYSERR; + /* FIXME: return error message to client via MHD! */ + return MHD_NO; } return helper_deposit_send_response_success (connection, deposit); |