-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Include column name in exception when ColumnSource.cast fails #6078
fix: Include column name in exception when ColumnSource.cast fails #6078
Conversation
try { | ||
// noinspection unchecked | ||
return rawColumnSource.cast(clazz, componentType); | ||
} catch (ClassCastException ex) { | ||
throw new RuntimeException( | ||
"Error retrieving ColumnSource with type " + clazz.getName() + " for column " + sourceName, ex); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s not better, or precise enough.
- No throwing RTEs. Throw something more specific.
- You should make it clearer that you’re throwing an exception because of a type mismatch. You would have failed before for a missing column.
- I think the existing error messaging is clearer and more specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better change would just be to add an optional "name" prefix to ColumnSource.cast
, so the existing exceptions could refer to "ColumnSource ".
No description provided.