diff options
author | Christopher Baines <mail@cbaines.net> | 2023-09-12 12:30:19 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-09-12 13:11:00 +0100 |
commit | f0d12594c4ea602d82682d292bcd17b662e56f6c (patch) | |
tree | e82002108f634afac5893d7669d2ebe3e765cd02 /nar-herder | |
parent | da624848f793511eadcaebfd6e516010377d560f (diff) | |
download | nar-herder-f0d12594c4ea602d82682d292bcd17b662e56f6c.tar nar-herder-f0d12594c4ea602d82682d292bcd17b662e56f6c.tar.gz |
Improve backtraces through call-with-cached-connection
Diffstat (limited to 'nar-herder')
-rw-r--r-- | nar-herder/storage.scm | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm index 5490226..e5ba57e 100644 --- a/nar-herder/storage.scm +++ b/nar-herder/storage.scm @@ -336,16 +336,12 @@ When VERIFY-CERTIFICATE? is true, verify HTTPS server certificates." socket)))))))) (define (call-with-cached-connection uri proc) - (with-exception-handler - (lambda (exn) - ;; Get a new connection, in case this exception is the result - ;; of a connection issue - (open-socket-for-uri/cached uri #:fresh? #t) - - (raise-exception exn)) - (lambda () - (proc (open-socket-for-uri/cached uri))) - #:unwind? #t)) + (let ((port (open-socket-for-uri/cached uri))) + (with-throw-handler #t + (lambda () + (proc port)) + (lambda _ + (close-port port))))) (define (start-nar-removal-fiber database storage-root storage-limit |