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)
|
startup-controller-thunk)
|
||||||
#:on-error 'backtrace
|
#:on-error 'backtrace
|
||||||
#:post-error (lambda args
|
#:post-error (lambda args
|
||||||
(render-html #:sxml (error-page
|
(case (most-appropriate-mime-type
|
||||||
(if (%show-error-details)
|
'(application/json text/html)
|
||||||
args
|
mime-types)
|
||||||
#f))
|
((application/json)
|
||||||
#:code 500))))
|
(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))))))
|
||||||
|
|
||||||
(define* (base-controller request method-and-path-components
|
(define* (base-controller request method-and-path-components
|
||||||
startup-completed?)
|
startup-completed?)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue