Skip to content

Commit

Permalink
Merge pull request #89 from RedHatInsights/bug/MWTELE-71
Browse files Browse the repository at this point in the history
fix: MWTELE-71 report HTTP 403 as forbidden and generic report of other 4xx status
  • Loading branch information
jponge authored May 11, 2023
2 parents 25ecef9 + 9bf1984 commit acad0e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/src/main/java/com/redhat/insights/InsightsErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public enum InsightsErrorCode {
ERROR_CLIENT_FAILED(19),
ERROR_CLIENT_BACKOFF_RETRIES_FAILED(20),
ERROR_INTERRUPTED_THREAD(21),
;
ERROR_HTTP_SEND_FORBIDDEN(22),
ERROR_HTTP_SEND_CLIENT_ERROR(23);

private static final String PREFIX = "I4ASR";
private final int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,18 @@ protected void sendInsightsReportWithClient(
case 401:
throw new InsightsException(
ERROR_HTTP_SEND_AUTH_ERROR, "Authentication missing from request");
case 403:
throw new InsightsException(ERROR_HTTP_SEND_FORBIDDEN, "Forbidden");
case 413:
throw new InsightsException(ERROR_HTTP_SEND_PAYLOAD, "Payload too large");
case 415:
default:
throw new InsightsException(
ERROR_HTTP_SEND_INVALID_CONTENT_TYPE,
"Content type of payload is unsupported");
default:
throw new InsightsException(
ERROR_HTTP_SEND_CLIENT_ERROR,
"Client error with HTTP status code " + statusCode);
}
case 5:
default:
Expand Down

0 comments on commit acad0e8

Please sign in to comment.