[plt-scheme] with-handlers and mzscheme extensions

From: David J. Neu (djneu at att.net)
Date: Sat Aug 21 17:03:08 EDT 2004

Hi!

I'm writing a mzscheme extension that raises some exceptions using
scheme_signal_error, and I'm wondering which predicate I could use in
with-handlers to determine which exception was raised.

For example, if the C code for the extension includes the line:

scheme_signal_error("error: exception-2 has occurred)

I'd like to be able to do something like this:

(with-handlers
    ((exception-1? (lambda (aexn) (printf "exception1~n")))
     (exception-2? (lambda (aexn) (printf "exception2~n"))))     
  (connection-open "dbname=test user=myusername password=mypassword"))


Many thanks for any help!
--David



Posted on the users mailing list.