Matt Sgarlata wrote:
> One situation I was considering is if you are doing something simple
> like Morph.convertToInteger("13asdf") you want a TransformationException
> instead of a JDK NumberFormatException. This would be in the interest
> of hiding implementation details of a particular transformer from a
> user. Fortunately, it appears the transformers happen to be written
> such that this is exactly what happens even with your change. Of course
> I will need to do testing to verify this is the case.
Hi Matt
If any transformer explicitly throws TransformationException, the patch
still propagates it up. That's probably why you're seeing the behavior
with convertToInteger (although not 100%, I haven't looked at the code).
All the patch does is modify all instances of "new
MorphException(Exception)" so that if the Exception is a
RuntimeException, throw RuntimeException directly. At no point does the
patch unwrap a TransformationException, opting instead to avoid creating
them in the first place.
Cheers
Ben
|