diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-patch-products-ID.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-patch-products-ID.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c b/src/backend/taler-merchant-httpd_private-patch-products-ID.c index 2e01b769..0d722b5f 100644 --- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c +++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c @@ -60,42 +60,32 @@ determine_cause (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_PRODUCTS_PATCH_DB_COMMIT_HARD_ERROR, - "Failed to get existing product"); + NULL); case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_INTERNAL_INVARIANT_FAILURE, - "Serialization error for single-statment request"); + "unexpected serialization problem"); case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_PRODUCTS_PATCH_UNKNOWN_PRODUCT, - "The specified product is unknown"); + product_id); case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: break; /* do below */ } { enum TALER_ErrorCode ec; - const char *hint; ec = TALER_EC_INTERNAL_INVARIANT_FAILURE; - hint = "transaction failed for causes unknown"; if (pdx.total_lost > pd->total_lost) - { ec = TALER_EC_PRODUCTS_PATCH_TOTAL_LOST_REDUCED; - hint = "total lost cannot be lowered"; - } if (pdx.total_stock > pd->total_stock) - { ec = TALER_EC_PRODUCTS_PATCH_TOTAL_STOCKED_REDUCED; - hint = "total stocked cannot be lowered"; - } if (pd->total_stock - pdx.total_sold > pd->total_lost) - { ec = TALER_EC_PRODUCTS_PATCH_TOTAL_LOST_EXCEEDS_STOCKS; - hint = "total lost cannot exceed total stock minus total sold"; - } GNUNET_free (pdx.description); json_decref (pdx.description_i18n); GNUNET_free (pdx.unit); @@ -105,7 +95,7 @@ determine_cause (struct MHD_Connection *connection, return TALER_MHD_reply_with_error (connection, MHD_HTTP_CONFLICT, ec, - hint); + NULL); } } @@ -206,14 +196,14 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh, ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_PRODUCTS_PATCH_DB_COMMIT_HARD_ERROR, - "Failed to commit change"); + NULL); break; case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_INTERNAL_INVARIANT_FAILURE, - "Serialization error for single-statment request"); + "unexpected serialization problem"); break; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: ret = determine_cause (connection, |