diff options
author | Andy Wingo <wingo@pobox.com> | 2012-03-11 10:57:05 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-03-22 09:56:27 +0100 |
commit | da03005a2a362847db2ac7e876cd9e31b20f9c73 (patch) | |
tree | eeee170c723b51d1a5515bfcf48465cf62d72ec5 /module/web/request.scm | |
parent | 1be6c7d34d7e1e40e78c8983bd8b40b3fbf7d01c (diff) | |
download | guile-da03005a2a362847db2ac7e876cd9e31b20f9c73.tar.gz |
add bad-request printer
* module/web/request.scm (bad-request-printer): Add printer for these
exceptions.
Diffstat (limited to 'module/web/request.scm')
-rw-r--r-- | module/web/request.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/module/web/request.scm b/module/web/request.scm index 8259887c0..40d4a668f 100644 --- a/module/web/request.scm +++ b/module/web/request.scm @@ -1,6 +1,6 @@ ;;; HTTP request objects -;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. ;; This library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public @@ -131,6 +131,17 @@ (define (bad-request message . args) (throw 'bad-request message args)) +(define (bad-request-printer port key args default-printer) + (apply (case-lambda + ((msg args) + (display "Bad request: " port) + (apply format port msg args) + (newline port)) + (_ (default-printer))) + args)) + +(set-exception-printer! 'bad-request bad-request-printer) + (define (non-negative-integer? n) (and (number? n) (>= n 0) (exact? n) (integer? n))) |