Provide more diagnostics when a constructor fails.

This commit is contained in:
Jesse Wilson 2011-10-22 20:22:47 +00:00
parent 94d59b550e
commit 290fb69a50

View File

@ -91,11 +91,12 @@ public final class ConstructorConstructor {
return (T) constructor.newInstance(args);
} catch (InstantiationException e) {
// TODO: JsonParseException ?
throw new RuntimeException(e);
throw new RuntimeException("Failed to invoke " + constructor + " with no args", e);
} catch (InvocationTargetException e) {
// TODO: don't wrap if cause is unchecked!
// TODO: JsonParseException ?
throw new RuntimeException(e.getTargetException());
throw new RuntimeException("Failed to invoke " + constructor + " with no args",
e.getTargetException());
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}