ExceptionChain or getCause for Failure #861

Closed
fanf opened this Issue Jan 25, 2011 · 3 comments

4 participants

@fanf

For debugging/logging purpose, I commonly have to find the root cause of a Failure.
When it is an exception and the failure is composed, I miss something like "messageChain" but which allows to find the deeper exception of the composition.

It is rather easy to build the list of Failure in a composed Failure with a little recursion and then find the first exception (if exists), but it would be even cooler if it was a built-in method of Failure, something like:

Failure#exceptionChain : List[Throwable] (deeper first ?)
or
Failure#getCause : Option[Throwable] (only the deepest ?) 
or even
Failure#failureChain : Seq[Failure] (deepest first ?)

See [[url:https://groups.google.com/d/topic/liftweb/CkdugELLGJA/discussion|https://groups.google.com/d/topic/liftweb/CkdugELLGJA/discussion]]

@ChristophKnabe

For consistency with the Java class Throwable I would prefer, that a method getCause will return only the immediate cause of a Failure, but not the deepest one.
For the latter I would suggest a name like getOriginalCause or getDeepestCause.

@dpp
Lift Web Framework member

(In [[r:18d569232ef2c75d135fd7dad73847bb842fe188]]) Closes #856. Makes Box a first class citizen in Loggable
Closes #861. Additional goodies for getting Exceptions from Failure
Ref #886. Makes user agent stuff more flexible

Branch: master

@dpp dpp was assigned Mar 1, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment