-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Description
Currently, the handleTypeMismatch method in ResponseEntityExceptionHandler does not include information about the required type in its error message.
I’d like to extend this handler so that the response includes the expected type information when a TypeMismatchException occurs. This would make debugging and client error handling easier, as users could immediately see which type was expected.
e.g.
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "'";
final Class<?> requiredType = e.getRequiredType();
if ( requiredType != null ) {
String defaultDetail = "Failed to convert '" + args[0] + "' with value: '" + args[1] + "' to be a valid " + requiredType.getSimpleName();
}
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement