[Haskell-cafe] examples for error handling in takusen?

Alistair Bayley alistair at abayley.org
Mon Mar 16 04:45:10 EDT 2009

2009/3/14 Gü?nther Schmidt <gue.schmidt at web.de>:
> Hi,
> can someone please point me to error handling examples with takusen?
> I try to run a piece of code with takusen but just get the very sparse
> "Database.InternalEnumerator.DBException

Hello Günther,

We use dynamic exceptions in Takusen, which is why you don't get much
useful information when an exception is thrown. We will include the
new extensible-exceptions code in the next release, so once that it
done perhaps we can change the way we do exceptions so that you get
better messages by default.

There are some basic exception handling functions in
Database.Enumerator which should help. Firstly, you need to add an
exception handler with catchDB. Then you can choose to ignore the
error, report it, or re-raise it (see basicDBExceptionReporter and
reportRethrow). Also, the DBException constructors are exported, so
you can pattern match on it to extract more information, like
SqlState, error number, and error message.


More information about the Haskell-Cafe mailing list