aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-01-22 10:01:23 +0000
committerChristopher Baines <mail@cbaines.net>2021-01-22 10:01:23 +0000
commit3673bda6064038bd56469993d4df5487b7054a53 (patch)
tree2008a6928d566940a2f635d3244e2af037d3c972 /guix-build-coordinator/agent-messaging
parent9e696733ac638acbb3c47197b2484cb6ecbc76a0 (diff)
downloadbuild-coordinator-3673bda6064038bd56469993d4df5487b7054a53.tar
build-coordinator-3673bda6064038bd56469993d4df5487b7054a53.tar.gz
Don't use with-exception-handler with (backtrace)
With with-exception-handler being called with #:unwind? #f (implicitly). This breaks Guile internals used by (backtrace) [1], meaning you get a different exception/backtrace when Guile itself breaks. This should avoid the "string->number: Wrong type argument in position 1 (expecting string): #f" exception I've been haunted by for the last year. 1: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=46009
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm37
1 files changed, 16 insertions, 21 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index 8a5e990..338bab6 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -427,26 +427,21 @@ port. Also, the port used can be changed by passing the --port option.\n"
(render-json
`((error . ,(agent-error-details exn)))
#:code 400)
- (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))))
+ (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))
+ (with-throw-handler #t
+ controller-thunk
+ (lambda (key . args)
+ (unless (and (eq? '%exception key)
+ (agent-error? (car args)))
+ (match method-and-path-components
+ ((method path-components ...)
+ (simple-format
+ (current-error-port)
+ "error: when processing: /~A ~A\n ~A ~A"
+ method (string-join path-components "/")
+ key args)))
+ (backtrace)))))
#:unwind? #t))