Skip to content
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

Improve error handling and stability for Jenkins Plugin #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

emily-bain
Copy link

Problem

We had some users occasionally encountering error conditions like JSON parsing issues where the previous approach was discarding useful debugging information about what the original response body was. The stack trace would reveal a parsing error but not the original text that was attempted to be parsed.

Similarly we were getting the odd failure of the plugin when builds weren't ready when we tried to perform actions.

Solution

We have reworked the response to return a string and the JSON is being parsed as a separate step so that if a parse error is encountered we can include the original body in the error message. This required a bit of restructuring the methods as with this approach we had no way of creating an HttpResponse<JsonNode> object, so now the bits of error handling that required the response have been pulled into the original getProject method and we return JsonNodes for consumption by higher level methods.

We also added a method at the start of the run to wait up to 10 seconds for a completed build to avoid any timing issues. This appears to be reasonable common amongst similar plugins.

Emin Tham and others added 3 commits October 8, 2020 15:02
    * Fixed it so that we get explicit message for non-JSON responses,
and print the response we receive
    * Improved the handling of unhandled errors to include more info on
the cause of the error if it exists.
    * Occasionally run would fail due to build not being ready, add a
timeout in case of timing issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant