Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: control-monad-exception 0.5 with monadic call traces

3 views
Skip to first unread message

Thomas Hartman

unread,
Nov 3, 2009, 8:59:50 AM11/3/09
to Haskell Cafe, HAppS
When using happstack, I find it really annoying to get a Prelude.head:
null list error (or similar) in my web browser window because
somewhere, some library used something unsafe -- and of course, since
this is haskell, no stack trace.

if c-m-e can offer benefits around this, I would be very interested in
adopting it.

thomas.

2009/11/3 Henning Thielemann <lem...@henning-thielemann.de>:
> Jose Iborra schrieb:
>> Folks,
>>
>> I'm happy to announce a new release of control-monad-exception with
>> monadic call traces,
>> available in Hackage. Grab it now while it is still online!
>>
>> Monadic stack traces are described in detail in a blog post [1].
>>
>> In short, what this means for your code is the ability to generate
>> errors like this:
>>
>> 500 Internal Server Error
>> The CGI server failed with the following error:
>> DeleteException (BmPK 2009-10-26 19:39:51.031297 UTC "Testing RPO")
>>  in deleteBenchmarkFromPK,
>> NarradarBenchmarkDB(src/NarradarBenchmarkDB.hs): (186, 44)
>>     deleteBenchmarkFromPK,
>> NarradarBenchmarkDB(src/NarradarBenchmarkDB.hs): (186, 25)
>>     deleteBenchmarkFromPK,
>> NarradarBenchmarkDB(src/NarradarBenchmarkDB.hs): (184, 17)
>>     deleteBenchmarkFromPK,
>> NarradarBenchmarkDB(src/NarradarBenchmarkDB.hs): (180, 90)
>>     deleteTests, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs):
>> (108, 3)
>>     deleteTests, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs):
>> (106, 20)
>>     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (52, 33)
>>     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (52, 30)
>>     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (50, 9)
>>     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (46, 11)
>
> Sure, this is a nice functionality. But isn't it about debugging, not
> exception handling? Internal Server Error means to me, the server has a
> bug, thus we want to know, how to reproduce it, thus the stack trace.
> For handling expected irregularites, what exceptions are, you would not
> need that, right?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskel...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

Thomas Hartman

unread,
Nov 3, 2009, 9:07:02 AM11/3/09
to Jose Iborra, HAppS
thanks; cc-ing happstack.

I had never heard of catchWithSrcLoc. Sounds useful.

2009/11/3 Jose Iborra <pepei...@gmail.com>:

> This is about error handling and reporting.
> Catching an exception does not tell you where the exception comes from, in
> the
> same way that a "head of empty list" error does not point at the source of
> the error.
> You need a stack trace to know that.
> So the output above, generated by a regular exception handler
>
>> cgiMain
>>   `catchWithSrcLoc`
>>     \loc e@SomeException{} ->
>>              outputInternalServerError [ "The Narradar CGI server failed
>> with the following error:"
>>                                        , showExceptionWithTrace loc e]
>
> gives you that kind of information.
> What you do with the stack trace, printing it (currently it is simply a list
> of Strings) or something else, is your choice.
>
> Thanks,
> pepe

Matthew Elder

unread,
Nov 3, 2009, 11:28:56 AM11/3/09
to ha...@googlegroups.com, Jose Iborra
this sounds very interesting. i hope ghc will adopt something like
this for the io monad.
--
Need somewhere to put your code? http://patch-tag.com
Want to build a webapp? http://happstack.com
Reply all
Reply to author
Forward
0 new messages