Skip to content

Commit becc31d

Browse files
committed
Update REST exception mapper
1 parent d1256ed commit becc31d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/org/hibernate/infra/sync/jira/service/jira/HandlerProjectContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.hibernate.infra.sync.jira.service.jira.model.rest.JiraIssueBulkResponse;
1313
import org.hibernate.infra.sync.jira.service.jira.model.rest.JiraIssues;
1414

15+
import io.quarkus.logging.Log;
16+
1517
public final class HandlerProjectContext {
1618

1719
// JIRA REST API creates upto 50 issues at a time:
@@ -99,6 +101,7 @@ private Long getCurrentLatestJiraIssueKeyNumber() {
99101
return JiraIssue.keyToLong(issues.issues.get(0).key);
100102
}
101103
} catch (Exception e) {
104+
Log.warn("Couldn't get the latest Jira issue key number", e);
102105
return -1L;
103106
}
104107
}

src/main/java/org/hibernate/infra/sync/jira/service/jira/client/JiraRestClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.hibernate.infra.sync.jira.service.jira.client;
22

3+
import java.net.URI;
34
import java.util.List;
45

56
import org.hibernate.infra.sync.jira.service.jira.model.rest.JiraComment;
@@ -146,10 +147,12 @@ static ObjectMapper objectMapper(ObjectMapper defaultObjectMapper) {
146147
}
147148

148149
@ClientExceptionMapper
149-
static RuntimeException toException(Response response) {
150+
static RuntimeException toException(URI uri, Response response) {
150151
if (response.getStatusInfo().getFamily() == Response.Status.Family.CLIENT_ERROR
151152
|| response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) {
152-
return new JiraRestException("Encountered an error calling Jira REST API. See server logs for details",
153+
return new JiraRestException(
154+
"Encountered an error calling Jira REST API: %s resulting in: %s".formatted(uri,
155+
response.hasEntity() ? response.readEntity(String.class) : "No response body"),
153156
response.getStatus());
154157
}
155158
return null;

0 commit comments

Comments
 (0)