diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-delete-products-ID.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-delete-products-ID.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd_private-delete-products-ID.c b/src/backend/taler-merchant-httpd_private-delete-products-ID.c index 2d17bafc..bb7964aa 100644 --- a/src/backend/taler-merchant-httpd_private-delete-products-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-products-ID.c @@ -40,6 +40,7 @@ TMH_private_delete_products_ID (const struct TMH_RequestHandler *rh, enum GNUNET_DB_QueryStatus qs; GNUNET_assert (NULL != mi); + GNUNET_assert (NULL != hc->infix); qs = TMH_db->delete_product (TMH_db->cls, mi->settings.id, hc->infix); @@ -49,18 +50,25 @@ TMH_private_delete_products_ID (const struct TMH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_GENERIC_DB_STORE_FAILED, - NULL); + "delete_product"); case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - NULL); + "delete_product (soft)"); case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + /* check if deletion must have failed because of locks by + checking if the product exists */ qs = TMH_db->lookup_product (TMH_db->cls, mi->settings.id, hc->infix, NULL); + if (GNUNET_DB_STATUS_HARD_ERROR == qs) + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, + "lookup_product"); if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, |