Skip to content
Permalink
Browse files
Treat Jira 4xx errors different from 5xx
Reviewed-by: ehelin
  • Loading branch information
rwestberg committed Nov 21, 2019
1 parent 1a8ea84 commit 6bea8f3126c8cdefcf92caefc5a484a72bf2c638
Showing 1 changed file with 4 additions and 1 deletion.
@@ -116,8 +116,11 @@ public Optional<Issue> issue(String id) {
}
var issueRequest = request.restrict("issue/" + id);
var issue = issueRequest.get("")
.onError(r -> r.statusCode() == 404 ? JSON.object().put("NOT_FOUND", true) : null)
.onError(r -> r.statusCode() < 500 ? JSON.object().put("NOT_FOUND", true) : null)
.execute();
if (issue == null) {
throw new RuntimeException("Server error when trying to fetch issue " + id);
}
if (!issue.contains("NOT_FOUND")) {
return Optional.of(new JiraIssue(this, issueRequest, issue));
} else {

0 comments on commit 6bea8f3

Please sign in to comment.