Add a JSON error page
This commit is contained in:
parent
84a2ad5b25
commit
94e66d5b1f
1 changed files with 14 additions and 5 deletions
|
|
@ -718,11 +718,20 @@
|
|||
startup-controller-thunk)
|
||||
#:on-error 'backtrace
|
||||
#:post-error (lambda args
|
||||
(case (most-appropriate-mime-type
|
||||
'(application/json text/html)
|
||||
mime-types)
|
||||
((application/json)
|
||||
(render-json `((error . ,(if (%show-error-details)
|
||||
(simple-format #f "~A" args)
|
||||
#f)))
|
||||
#:code 500))
|
||||
(else
|
||||
(render-html #:sxml (error-page
|
||||
(if (%show-error-details)
|
||||
args
|
||||
#f))
|
||||
#:code 500))))
|
||||
#:code 500))))))
|
||||
|
||||
(define* (base-controller request method-and-path-components
|
||||
startup-completed?)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue