Compare commits

..

2 commits

Author SHA1 Message Date
8f3e0a9a1d Fix exception handling in fibers-map-with-progress
All checks were successful
/ test (push) Successful in 9s
2025-06-26 22:53:15 +02:00
09ca6cfb6b Fix resource-pool-destroy-resource-exception
Raising the exception is more consistent, and avoids returning the
resource.
2025-06-26 21:27:32 +02:00
3 changed files with 23 additions and 6 deletions

View file

@ -217,9 +217,9 @@
(if (null? active-channels)
(map
(match-lambda
((#f . ('exception . exn))
((#f . ('exception exn))
(raise-exception exn))
((#f . ('result . val))
((#f . ('result val))
val))
channels-to-results)
(loop
@ -239,10 +239,10 @@
(if (eq? channel c)
(cons #f
(match result
(('exception . exn)
(('exception exn)
result)
(_
(cons 'result result))))
(list 'result result))))
(cons c r))))
channels-to-results)))
#f))))

View file

@ -1351,8 +1351,7 @@ available. Return the resource once PROC has returned."
'destroy
'return)
resource))
(unless (resource-pool-destroy-resource-exception? exn)
(raise-exception exn)))
(raise-exception exn))
(lambda ()
(with-exception-handler
(lambda (exn)

View file

@ -61,6 +61,24 @@
identity
'(()))))
(run-fibers-for-tests
(lambda ()
(with-exception-handler
(lambda (exn)
(unless (and (exception-with-message? exn)
(string=? (exception-message exn)
"foo"))
(raise-exception exn)))
(lambda ()
(fibers-map-with-progress
(lambda _
(raise-exception
(make-exception-with-message "foo")))
'((1)))
(error 'should-not-reach-here))
#:unwind? #t)))
(run-fibers-for-tests
(lambda ()
(with-exception-handler