diff --git a/api/src/main/java/com/redhat/insights/InsightsErrorCode.java b/api/src/main/java/com/redhat/insights/InsightsErrorCode.java index 335202a..58c6955 100644 --- a/api/src/main/java/com/redhat/insights/InsightsErrorCode.java +++ b/api/src/main/java/com/redhat/insights/InsightsErrorCode.java @@ -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; diff --git a/runtime/src/main/java/com/redhat/insights/core/httpclient/InsightsJdkHttpClient.java b/runtime/src/main/java/com/redhat/insights/core/httpclient/InsightsJdkHttpClient.java index 82ebdfb..71568ad 100644 --- a/runtime/src/main/java/com/redhat/insights/core/httpclient/InsightsJdkHttpClient.java +++ b/runtime/src/main/java/com/redhat/insights/core/httpclient/InsightsJdkHttpClient.java @@ -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: