Better guard against exceptions in the build event handlers

This commit is contained in:
Christopher Baines 2022-11-19 09:46:16 +00:00
parent ca1e4819b6
commit 205f020950

View file

@ -144,7 +144,20 @@
(with-postgresql-connection
"build-event-handler-conn"
(lambda (conn)
(handler conn ids)))))))))
(with-exception-handler
(lambda (exn)
(simple-format
(current-error-port)
"exception in build event handler: ~A\n"
exn))
(lambda ()
(with-throw-handler #t
(lambda ()
(handler conn ids))
(lambda _
(display (backtrace) (current-error-port))
(display "\n" (current-error-port)))))
#:unwind? #t)))))))))
(define (handle-derivation-events conn items)
(if (null? items)