-
-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Description
When a SingleValue does its conversion it is painful to figure out which parameter actually caused the exception even though SingleValue has the name.
java.lang.IllegalArgumentException: UUID string too large
at java.base/java.util.UUID.fromString1(UUID.java:266)
at java.base/java.util.UUID.fromString(UUID.java:260)
at io.jooby.internal.converter.UUIDConverter.convert(UUIDConverter.java:21)
at io.jooby.internal.ValueConverters.convert(ValueConverters.java:119)
at io.jooby.internal.ValueConverters.convert(ValueConverters.java:71)
at io.jooby.DefaultContext.convertOrNull(DefaultContext.java:410)
at io.jooby.internal.SingleValue.toNullable(SingleValue.java:95)
at SomeController_.get(SomeController_.java:37)
In SingleValue we have:
@NonNull @Override
public <T> T to(@NonNull Class<T> type) {
return ctx.convert(this, type);
}
@Nullable @Override
public <T> T toNullable(@NonNull Class<T> type) {
return ctx.convertOrNull(this, type);
}In theory we do not need to change API at all but have the builtin converters check if the passed in this has a Value.name() and wrap the exception.
Reactions are currently unavailable