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
|
(if (member provided-token
|
||||||
(map cdr permitted-tokens)
|
(map cdr permitted-tokens)
|
||||||
string=?)
|
string=?)
|
||||||
(catch
|
(with-exception-handler
|
||||||
'json-invalid
|
(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 ()
|
(lambda ()
|
||||||
(let ((body-string (utf8->string body)))
|
(let ((body-string (utf8->string body)))
|
||||||
(let* ((body-json (json-string->scm body-string))
|
(let* ((body-json (json-string->scm body-string))
|
||||||
|
|
@ -294,30 +301,27 @@
|
||||||
'((error . "no items to process"))
|
'((error . "no items to process"))
|
||||||
#:code 400))
|
#:code 400))
|
||||||
(else
|
(else
|
||||||
(catch
|
(with-exception-handler
|
||||||
#t
|
(lambda (exn)
|
||||||
|
(render-json
|
||||||
|
'((error . "could not process events"))
|
||||||
|
#:code 500))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(process-items items)
|
(with-exception-handler
|
||||||
|
(lambda (exn)
|
||||||
|
(print-backtrace-and-exception/knots exn)
|
||||||
|
(simple-format (current-error-port)
|
||||||
|
"error processing events: ~A\n"
|
||||||
|
exn)
|
||||||
|
(for-each (lambda (item)
|
||||||
|
(simple-format (current-error-port)
|
||||||
|
" ~A\n" item))
|
||||||
|
items))
|
||||||
|
(lambda ()
|
||||||
|
(process-items items)))
|
||||||
(no-content))
|
(no-content))
|
||||||
(lambda (key . args)
|
#:unwind? #t))))))
|
||||||
(simple-format (current-error-port)
|
#:unwind? #t)))))))
|
||||||
"error processing events: ~A: ~A\n"
|
|
||||||
key
|
|
||||||
args)
|
|
||||||
(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)))))))
|
|
||||||
|
|
||||||
(define (handle-signing-key-request id)
|
(define (handle-signing-key-request id)
|
||||||
(render-html
|
(render-html
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue