-
Notifications
You must be signed in to change notification settings - Fork 736
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
Better error messages #254
Conversation
…n with url, http responseCode and http responseMessage to help exception handling.
@reviewbybees esp @recena @oleg-nenashev |
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
@@ -458,6 +463,7 @@ public boolean isCredentialValid() throws IOException { | |||
retrieve().to("/user", GHUser.class); | |||
return true; | |||
} catch (IOException e) { | |||
logger.log(Level.FINEST, "Exception validating credentials on {0} with login {1}: {2}", new Object[]{this.apiUrl, this.login, e, e}); |
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.
Probably FINE
would be appropriate.
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.
🐛 you are trying to pass four parameters to a three-argument message parameter; probably you meant to put the last e
outside the braces, but this does not work because the preformatted overloads do not also accept Throwable
. Also including Throwable.toString
in the message is pointless when you are including the full stack trace anyway. So what you meant was probably something like
logger.log(Level.FINE, "Exception validating credentials on " + apiUrl + " with login " + login, e);
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.
Thanks, I'll never get on well with java.util.logging :-)
@jglick I have updated the code according to your recommendations! |
Better error message:
FINEST
log message inGitHub.isCredentialsValid()
in case of exception as we silently swallow this exception.