aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator
diff options
context:
space:
mode:
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r--guix-build-coordinator/client-communication.scm37
1 files changed, 24 insertions, 13 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm
index 16fa529..580773b 100644
--- a/guix-build-coordinator/client-communication.scm
+++ b/guix-build-coordinator/client-communication.scm
@@ -378,19 +378,30 @@
"not-found"
#:code 404))))
- (call-with-error-handling
- controller-thunk
- #:on-error 'backtrace
- #:post-error (lambda args
- (match method-and-path-components
- ((method path-components ...)
- (simple-format
- (current-error-port)
- "error: when processing: /~A ~A\n"
- method (string-join path-components "/"))))
- (render-json
- `((error . ,(simple-format #f "~A" args)))
- #:code 500))))
+ (with-exception-handler
+ (lambda (exn)
+ (match method-and-path-components
+ ((method path-components ...)
+ (simple-format
+ (current-error-port)
+ "error: when processing client request: /~A ~A\n ~A"
+ method (string-join path-components "/")
+ exn)))
+ (render-json
+ `((error . ,(simple-format #f "~A" exn)))
+ #:code 500))
+ (lambda ()
+ (with-exception-handler
+ (lambda (exn)
+ (catch #t
+ (lambda ()
+ (backtrace))
+ (lambda (key . args)
+ (simple-format (current-error-port)
+ "error: guile crashed printing backtrace\n")))
+ (raise-exception exn))
+ controller-thunk))
+ #:unwind? #t))
(define* (render-json json #:key (extra-headers '())
(code 200))