where to catch handler exception

30 views
Skip to first unread message

CCH C

unread,
Mar 20, 2012, 5:47:32 AM3/20/12
to snap_fr...@googlegroups.com
Hi, I am using auth snaplet, where shall I catch the duplicateLogin exception or any other exception. I don't want to let the app respond with a "web handler exception" text. I read the Control.Exception docs, and find that `catch` can only be used in IO monad. How can I `catch` in MandSnap?

Thanks 

MightyByte

unread,
Mar 20, 2012, 8:06:53 AM3/20/12
to snap_fr...@googlegroups.com
If you look at the documentation for the Handler monad, you'll see
that it is an instance of MonadCatchIO.

http://hackage.haskell.org/packages/archive/snap/0.8.0.2/doc/html/Snap-Snaplet.html#t:Handler

If you click on that instance, you'll see the exception handling
functions you're looking for.

http://hackage.haskell.org/packages/archive/MonadCatchIO-transformers/0.2.2.3/doc/html/Control-Monad-CatchIO.html#t:MonadCatchIO

CCH C

unread,
Mar 20, 2012, 9:11:14 AM3/20/12
to snap_fr...@googlegroups.com
Now I see. Thank you so much!
Reply all
Reply to author
Forward
0 new messages