Mercurial > urweb
comparison src/c/request.c @ 1131:94e83c5533d2
Handling errors during commit
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 26 Jan 2010 14:59:19 -0500 |
parents | 150465f2895c |
children | b08b73591d2c |
comparison
equal
deleted
inserted
replaced
1130:67d875c8ac71 | 1131:94e83c5533d2 |
---|---|
337 } | 337 } |
338 strcpy(rc->path_copy, path); | 338 strcpy(rc->path_copy, path); |
339 fk = uw_begin(ctx, rc->path_copy); | 339 fk = uw_begin(ctx, rc->path_copy); |
340 if (fk == SUCCESS || fk == RETURN_INDIRECTLY) { | 340 if (fk == SUCCESS || fk == RETURN_INDIRECTLY) { |
341 uw_commit(ctx); | 341 uw_commit(ctx); |
342 return SERVED; | 342 if (uw_has_error(ctx)) { |
343 log_error(logger_data, "Fatal error: %s\n", uw_error_message(ctx)); | |
344 | |
345 uw_reset_keep_error_message(ctx); | |
346 on_failure(ctx); | |
347 uw_write_header(ctx, "Content-type: text/html\r\n"); | |
348 uw_write(ctx, "<html><head><title>Fatal Error</title></head><body>"); | |
349 uw_write(ctx, "Fatal error: "); | |
350 uw_write(ctx, uw_error_message(ctx)); | |
351 uw_write(ctx, "\n</body></html>"); | |
352 | |
353 return FAILED; | |
354 } else | |
355 return SERVED; | |
343 } else if (fk == BOUNDED_RETRY) { | 356 } else if (fk == BOUNDED_RETRY) { |
344 if (retries_left) { | 357 if (retries_left) { |
345 log_debug(logger_data, "Error triggers bounded retry: %s\n", uw_error_message(ctx)); | 358 log_debug(logger_data, "Error triggers bounded retry: %s\n", uw_error_message(ctx)); |
346 --retries_left; | 359 --retries_left; |
347 } | 360 } |