Skip to content

Commit acad0e8

Browse files
authored
Merge pull request #89 from RedHatInsights/bug/MWTELE-71
fix: MWTELE-71 report HTTP 403 as forbidden and generic report of other 4xx status
2 parents 25ecef9 + 9bf1984 commit acad0e8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

api/src/main/java/com/redhat/insights/InsightsErrorCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public enum InsightsErrorCode {
2929
ERROR_CLIENT_FAILED(19),
3030
ERROR_CLIENT_BACKOFF_RETRIES_FAILED(20),
3131
ERROR_INTERRUPTED_THREAD(21),
32-
;
32+
ERROR_HTTP_SEND_FORBIDDEN(22),
33+
ERROR_HTTP_SEND_CLIENT_ERROR(23);
3334

3435
private static final String PREFIX = "I4ASR";
3536
private final int code;

runtime/src/main/java/com/redhat/insights/core/httpclient/InsightsJdkHttpClient.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,18 @@ protected void sendInsightsReportWithClient(
162162
case 401:
163163
throw new InsightsException(
164164
ERROR_HTTP_SEND_AUTH_ERROR, "Authentication missing from request");
165+
case 403:
166+
throw new InsightsException(ERROR_HTTP_SEND_FORBIDDEN, "Forbidden");
165167
case 413:
166168
throw new InsightsException(ERROR_HTTP_SEND_PAYLOAD, "Payload too large");
167169
case 415:
168-
default:
169170
throw new InsightsException(
170171
ERROR_HTTP_SEND_INVALID_CONTENT_TYPE,
171172
"Content type of payload is unsupported");
173+
default:
174+
throw new InsightsException(
175+
ERROR_HTTP_SEND_CLIENT_ERROR,
176+
"Client error with HTTP status code " + statusCode);
172177
}
173178
case 5:
174179
default:

0 commit comments

Comments
 (0)