Mercurial > urweb
comparison src/c/urweb.c @ 283:c0e4ac23522d
'error' function
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 10:02:27 -0400 |
parents | 0236d9412ad2 |
children | 77a28e7430bf |
comparison
equal
deleted
inserted
replaced
282:0236d9412ad2 | 283:c0e4ac23522d |
---|---|
94 lw_handle(ctx, path); | 94 lw_handle(ctx, path); |
95 | 95 |
96 return r; | 96 return r; |
97 } | 97 } |
98 | 98 |
99 void lw_error(lw_context ctx, failure_kind fk, const char *fmt, ...) { | 99 __attribute__((noreturn)) void lw_error(lw_context ctx, failure_kind fk, const char *fmt, ...) { |
100 va_list ap; | 100 va_list ap; |
101 va_start(ap, fmt); | 101 va_start(ap, fmt); |
102 | 102 |
103 vsnprintf(ctx->error_message, ERROR_BUF_LEN, fmt, ap); | 103 vsnprintf(ctx->error_message, ERROR_BUF_LEN, fmt, ap); |
104 | 104 |
105 longjmp(ctx->jmp_buf, fk); | 105 longjmp(ctx->jmp_buf, fk); |
106 } | |
107 | |
108 __attribute__((noreturn)) void lw_Basis_error(lw_context ctx, const char *s) { | |
109 lw_error(ctx, FATAL, s); | |
106 } | 110 } |
107 | 111 |
108 char *lw_error_message(lw_context ctx) { | 112 char *lw_error_message(lw_context ctx) { |
109 return ctx->error_message; | 113 return ctx->error_message; |
110 } | 114 } |