From 25f4d797b606f568497c194c080e8808aea973a5 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 23 Jan 2011 18:16:30 -0500 Subject: Proper error handling for periodic tasks --- src/c/urweb.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/c/urweb.c') diff --git a/src/c/urweb.c b/src/c/urweb.c index 67df7a2e..693cc87f 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -3684,15 +3684,12 @@ uw_Basis_postBody uw_getPostBody(uw_context ctx) { failure_kind uw_runCallback(uw_context ctx, void (*callback)(uw_context)) { int r = setjmp(ctx->jmp_buf); - if (ctx->app->db_begin(ctx)) - uw_error(ctx, BOUNDED_RETRY, "Error running SQL BEGIN"); - if (r == 0) { + if (ctx->app->db_begin(ctx)) + uw_error(ctx, BOUNDED_RETRY, "Error running SQL BEGIN"); + callback(ctx); - uw_commit(ctx); } - else - uw_rollback(ctx, 0); return r; } -- cgit v1.2.3