-
Notifications
You must be signed in to change notification settings - Fork 17
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
ResourceIdentifier exceptions are SafeLoggable for better, safer observability #594
Conversation
Generate changelog in
|
@@ -328,7 +332,7 @@ public static ResourceIdentifier valueOf(String rid) { | |||
public static ResourceIdentifier of(String rid) { | |||
ResourceIdentifier resultRid = tryOf(rid); | |||
if (resultRid == null) { | |||
throw new IllegalArgumentException("Illegal resource identifier format: " + rid); | |||
throw new SafeIllegalArgumentException("Illegal resource identifier format", UnsafeArg.of("rid", rid)); |
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.
nit: This isn't incorrect now, but shall we also update the javadoc to @throws SafeIllegalArgumentException
?
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.
In general we don’t really want folks to catch the safe variants, so we don’t want folks to rely on the safe variant being api, but that would be more specific in javadoc. I could go either way :-)
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.
Ok. If people shouldn't be catching only the safe variants, then having the API specify the superclass lets them know what to catch instead.
No strong stance either, but leaning towards keeping as-is with the principle "the @ throws block in the javadoc should specify what devs to should catch".
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.
Going to merge given this was the only comment.
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.
Removed merge-when-ready
. Approving.
Released 2.8.0 |
==COMMIT_MSG==
ResourceIdentifier exceptions are SafeLoggable for better, safer observability
==COMMIT_MSG==