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

fix: MWTELE-71 report HTTP 403 as forbidden and generic report of other 4xx status #89

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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