I have a with-handlers expression which handles several exceptions 
appropriately and raises user-error exceptions, I have some additional code 
I'd like to be executed after the exception have been handled, analogous to 
dyanmic-wind's post-thunk argument or like the finally clause of a 
conventional try{}catch{}finally{} structure found in other languages.

Documentation has shown that with-handlers and its cousins don't seem to 
have anything like that so I thought I'd wrap my with-handlers expression 
in a call-with-exception-handler to intercept the raised user-error 
exceptions, do additional processing and returns the exception to continue 
its propagation. It's not working and the installed exception handler 
doesn't seem to be called at all.

Here's simplified code.

(call-with-exception-handler 
   (lambda (e) 
     ...do more work 
     e) 
    (with-handlers ([exn:a? (lambda (e) (raise-user-error "exception exn:a 
caught"))] 
                          [exn:b? (lambda (e) (raise-user-error "exception 
exn:b caught"))]) 
          ...code that may throw either exn:a or exn:b ))

My expectation was that the lambda installed by the 
call-with-exception-handler would run after each user-error is raised. I do 
see the user-error exceptions' messages being printed in the terminal so 
they're being propagated all the way to the uncaught exception handler but 
no work is being done by my own lambda handler. What am I doing wrong? More 
to the point, is there a better way to do post with-handlers exception 
handling processing?

My thinking is that I have a flawed understanding of the meaning of dynamic 
extent of with-handlers and call-with-exception-handler forms.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to