-
Notifications
You must be signed in to change notification settings - Fork 26
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
add error information for when sonatype fails #32
Conversation
The result after using my local install of this plugin is something like this...
|
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.
And thanks for the contribution :).
HttpResponseDecorator response = (HttpResponseDecorator)restClient.post(params) | ||
log.warn("POST response data: ${response.data}") | ||
try { | ||
//TODO: Add better error handling (e.g. display error message received from server, not only 500 + not fail on 404 in 'text/html') |
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.
This comment is no longer valid after your changes :).
HttpResponseDecorator resp = e.getResponse(); | ||
String message = "${resp.statusLine.statusCode}:${resp.statusLine.reasonPhrase} body=${resp.data}" | ||
log.error("POST response failed. ${message}") | ||
throw new HttpResponseException(e.getStatusCode(), message) |
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.
We lose original stacktrace. Please include e
as a cause.
//TODO: Add better error handling (e.g. display error message received from server, not only 500 + not fail on 404 in 'text/html') | ||
HttpResponseDecorator response = (HttpResponseDecorator)restClient.post(params) | ||
log.warn("POST response data: ${response.data}") | ||
} catch(groovyx.net.http.HttpResponseException 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.
Missing space after catch
//put all information there (status code, error str, body of response in case they put more error information there) | ||
|
||
HttpResponseDecorator resp = e.getResponse(); | ||
String message = "${resp.statusLine.statusCode}:${resp.statusLine.reasonPhrase} body=${resp.data}" |
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.
(two spaces) before body
- one would be enough.
String message = "${resp.statusLine.statusCode}:${resp.statusLine.reasonPhrase} body=${resp.data}" | ||
log.error("POST response failed. ${message}") | ||
throw new HttpResponseException(e.getStatusCode(), message) | ||
} |
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.
Please reformat this code fragment in general. It seems your are using tabs instead of spaces.
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.
I created #33 to better handle that.
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.
And thanks for the contribution :).
And you can also squash those commits into one. |
@deanhiller Can you fix the things I mentioned in the code review to make this PR being merged? |
I reworked it your changes and merged them manually. |
This adds the info so e.getMessage() when used which is printed when using --stacktrace. Also, we log the same thing as well for those not using --stacktrace as this is a pretty important failure and one needs to know the issue that occurred from the remote end.