aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-01-16 22:18:58 +0000
committerChristopher Baines <mail@cbaines.net>2021-01-16 22:18:58 +0000
commit73e002990f11e3e9fbcd2803b284c75f8e00dde5 (patch)
treea071938dc6547d8b397e1efc108bb5de18d851c5 /guix-build-coordinator/agent-messaging
parente1b3ccb8a4903da7ecb05daccf32a938c1995ffa (diff)
downloadbuild-coordinator-73e002990f11e3e9fbcd2803b284c75f8e00dde5.tar
build-coordinator-73e002990f11e3e9fbcd2803b284c75f8e00dde5.tar.gz
Tweak agent messaging error handling
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm31
1 files changed, 21 insertions, 10 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index d02bc83..9181736 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -423,19 +423,30 @@ port. Also, the port used can be changed by passing the --port option.\n"
(with-exception-handler
(lambda (exn)
- (match method-and-path-components
- ((method path-components ...)
- (simple-format
- (current-error-port)
- "error: when processing: /~A ~A\n"
- method (string-join path-components "/"))))
(if (agent-error? exn)
(render-json
`((error . ,(agent-error-details exn)))
#:code 400)
- (render-json
- `((error . ,(simple-format #f "~A" exn)))
- #:code 500)))
- controller-thunk
+ (begin
+ (match method-and-path-components
+ ((method path-components ...)
+ (simple-format
+ (current-error-port)
+ "error: when processing: /~A ~A\n ~A"
+ method (string-join path-components "/")
+ exn)))
+ (render-json
+ `((error . ,(simple-format #f "~A" exn)))
+ #:code 500))))
+ (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))