On 03/11/2009, at 14:24, Henning Thielemann wrote:

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?


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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to