diff options
author | Andy Wingo <wingo@pobox.com> | 2012-03-11 10:24:08 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-03-22 09:56:27 +0100 |
commit | 1be6c7d34d7e1e40e78c8983bd8b40b3fbf7d01c (patch) | |
tree | bff848830fa880e756e6d3c5dcadbcf82431ab79 /module/web/http.scm | |
parent | 47153f29b02cee6324aec523cfa44b48e1cb29b9 (diff) | |
download | guile-1be6c7d34d7e1e40e78c8983bd8b40b3fbf7d01c.tar.gz |
add exception printers for bad-header, bad-header-component
* module/web/http.scm (bad-header-component): Throw
'bad-header-component instead of 'bad-header.
(bad-header-printer, bad-header-component-printer): Add exception
printers.
Diffstat (limited to 'module/web/http.scm')
-rw-r--r-- | module/web/http.scm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/module/web/http.scm b/module/web/http.scm index ad9063cd2..d579c5267 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -240,7 +240,22 @@ ordered alist." (define (bad-header sym val) (throw 'bad-header sym val)) (define (bad-header-component sym val) - (throw 'bad-header sym val)) + (throw 'bad-header-component sym val)) + +(define (bad-header-printer port key args default-printer) + (apply (case-lambda + ((sym val) + (format port "Bad ~a header: ~a\n" (header->string sym) val)) + (_ (default-printer))) + args)) +(define (bad-header-component-printer port key args default-printer) + (apply (case-lambda + ((sym val) + (format port "Bad ~a header component: ~a\n" sym val)) + (_ (default-printer))) + args)) +(set-exception-printer! 'bad-header bad-header-printer) +(set-exception-printer! 'bad-header-component bad-header-component-printer) (define (parse-opaque-string str) str) |