Since I've been asked about getting location information about exceptions happening in threads, and I still haven't gotten around updating all of my code to current Gambit, I've now adapted cj-exception and put it here: http://scheme.mine.nu/gambit/preview/cj-exception.scm
(with-ec-catcher (lambda() (/ 1 0) 43)) *** ERROR IN (console)@1.1 -- This object was raised: #<exception/continuation #2 exception: #<divide-by-zero-exception #3> continuation: #<continuation #4>> 1> ctl-d (exception/continuation-message-in-context #2) "*** ERROR IN #<procedure #5>, (console)@2.28 -- Divide by zero\n(/ 1 0)\n" (display (exception/continuation-contextlines #2)) 0 #<procedure #5> (console)@2:28 (/ 1 0) 1 (interaction) (console)@2:1 (with-ec-catcher (lambda ... 2 ##main
Same thing when used like:
(define spawn (lambda (thunk) (thread-start! (make-thread (lambda () (with-ec-catcher thunk)))))) (spawn (lambda() (/ 1 0) 43)) #<thread #6> (thread-join! #6) *** ERROR IN (console)@6.1 -- Uncaught exception: #<exception/continuation #7 exception: #<divide-by-zero-exception #8> continuation: #<continuation #9>> (thread-join! '#<thread #6>) 1>
Christian.