Experimental IRC log happs-2008-07-20

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

Back to channel and daily index: content-negotiated html turtle

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

13:45:12<titto>hi, does anyone know how to override the default error handling of HApps (that will return a text/plain message reading "Server err.) ?
13:46:14<titto>I am handling a json request and, in case of error, I would like to return a text/javascript document with a JavaScript exception.
13:49:22<titto>I see that there is a new function in SimpleHTTP called errorHandlerSP that allow to throw/catch monad errors in the request handlers, however it does not seem to capture IO or pattern matching errors, only errors that are exclicitly thrown using throwError
14:02:23<titto>so the question really is: how do I capture in a request handler a IO or pattern matching exception so that I can return my own customised response?
14:31:26<dcoutts>titto: Control.Exception allows you to catch all exceptions, IO and pattern match failures etc
14:35:07<titto>right, but I have a handler that has type .. -> WebT ..
14:35:30<titto>The handler code is something like: do
14:35:32<titto> ...
14:35:38<titto>x <- liftIO ...
14:36:00<titto>throwError ".."
14:36:49<titto>now I can capture the exceptions thrown by throwError but how to I capture those thrown in liftIO ?
14:37:40<titto>HAppS can do it because it executes my handler in the context of a 'catch' but how do I do it as I can only return a WebT or ServerPart .... ?
14:39:57<titto>my main function calls simpleHTTP that has type: simpleHTTP :: (ToMessage a) => Conf -> [ServerPartT IO a] -> IO ()
14:40:57<dcoutts>titto: how about catching using liftIO
14:41:21<dcoutts>otherwise I don't really know, I'm not a happs expert
14:42:32<titto>I was thinking of replacing my calls to liftIO with something that would catch an IO exception and convert it into a 'throwError'
14:42:48<titto>like in :
14:42:59<titto>myLiftIO f = liftIO $ handle (\e -> throwError $ show e) f
14:43:39<titto>but it won't compile.
14:45:16<titto>did you mean something like that by ' catching using liftIO' ?

Back to channel and daily index: content-negotiated html turtle