[racket] Exception decorator. is it possible?

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Wed Sep 17 12:59:15 EDT 2014

 I'm writeing a parser.
So I want to see in parser exception what happend and when (not only where).

(define (parse-item item)
   (with-handlers ([exn? (lambda (e) (raise (struct-copy exn e [message (format "At item ~a\n~a" item (exn-message e))])))])
         ....))

But this way I lose all exception types. Is there a way to change exception message, saving its type, except long copy/paste like
(with-handlers ([exn:fail:contract:arity? (raise (struct-copy exn:fail:contract:arity ...))]
                         [exn:fil:contract? (raise (struct-copy exn:fail:contract ...))]
                         ...) 
   ...)

?

-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140917/de704e03/attachment.html>

Posted on the users mailing list.