Update exception handling for build events
This commit is contained in:
parent
d60a8a44cb
commit
14de1667b1
1 changed files with 28 additions and 24 deletions
|
|
@ -277,8 +277,15 @@
|
|||
(if (member provided-token
|
||||
(map cdr permitted-tokens)
|
||||
string=?)
|
||||
(catch
|
||||
'json-invalid
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(if (eq? (exception-kind exn) 'json-invalid)
|
||||
(render-json
|
||||
'((error . "could not parse body as JSON"))
|
||||
#:code 400)
|
||||
(render-json
|
||||
'((error . "error"))
|
||||
#:code 403)))
|
||||
(lambda ()
|
||||
(let ((body-string (utf8->string body)))
|
||||
(let* ((body-json (json-string->scm body-string))
|
||||
|
|
@ -294,30 +301,27 @@
|
|||
'((error . "no items to process"))
|
||||
#:code 400))
|
||||
(else
|
||||
(catch
|
||||
#t
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(render-json
|
||||
'((error . "could not process events"))
|
||||
#:code 500))
|
||||
(lambda ()
|
||||
(process-items items)
|
||||
(no-content))
|
||||
(lambda (key . args)
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(print-backtrace-and-exception/knots exn)
|
||||
(simple-format (current-error-port)
|
||||
"error processing events: ~A: ~A\n"
|
||||
key
|
||||
args)
|
||||
"error processing events: ~A\n"
|
||||
exn)
|
||||
(for-each (lambda (item)
|
||||
(simple-format (current-error-port)
|
||||
" ~A\n" item))
|
||||
items)
|
||||
(render-json
|
||||
'((error . "could not process events"))
|
||||
#:code 500))))))))
|
||||
(lambda (key . args)
|
||||
(render-json
|
||||
'((error . "could not parse body as JSON"))
|
||||
#:code 400)))
|
||||
(render-json
|
||||
'((error . "error"))
|
||||
#:code 403)))))))
|
||||
items))
|
||||
(lambda ()
|
||||
(process-items items)))
|
||||
(no-content))
|
||||
#:unwind? #t))))))
|
||||
#:unwind? #t)))))))
|
||||
|
||||
(define (handle-signing-key-request id)
|
||||
(render-html
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue