mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
add bad-request printer
* module/web/request.scm (bad-request-printer): Add printer for these exceptions.
This commit is contained in:
parent
aaaa0eef9c
commit
e0dc497832
1 changed files with 12 additions and 1 deletions
|
@ -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)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue