ExceptionChain or getCause for Failure
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:
See https://groups.google.com/d/topic/liftweb/CkdugELLGJA/discussion
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 https://groups.google.com/d/topic/liftweb/CkdugELLGJA/discussion
Leave a comment
on 2011-01-26 14:33 *
By Christoph Knabe
For consistency with the Java class
For the latter I would suggest a name like
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
.
(In revision: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
Closes #861. Additional goodies for getting Exceptions from Failure
Ref #886. Makes user agent stuff more flexible
Branch: master