diff options
author | Christopher Baines <mail@cbaines.net> | 2021-01-22 10:01:23 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-01-22 10:01:23 +0000 |
commit | 3673bda6064038bd56469993d4df5487b7054a53 (patch) | |
tree | 2008a6928d566940a2f635d3244e2af037d3c972 /guix-build-coordinator/client-communication.scm | |
parent | 9e696733ac638acbb3c47197b2484cb6ecbc76a0 (diff) | |
download | build-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/client-communication.scm')
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 580773b..4fdfade 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -380,27 +380,21 @@ (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))) + `((error . 500)) #: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) + (match method-and-path-components + ((method path-components ...) + (simple-format + (current-error-port) + "error: when processing client request: /~A ~A\n ~A ~A\n" + method (string-join path-components "/") + key args))) + (backtrace)))) #:unwind? #t)) (define* (render-json json #:key (extra-headers '()) |