From c74c7d8e0a9754217e532cb6e466532c40198c89 Mon Sep 17 00:00:00 2001 From: Henry Borasch <Henry.Borasch@sinc.de> Date: Mon, 24 Apr 2023 07:46:18 +0200 Subject: [PATCH] 978: set default HTTP error code to 500 --- .../fitko/fitconnect/api/exceptions/RestApiException.java | 2 +- .../java/dev/fitko/fitconnect/core/http/HttpClient.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/dev/fitko/fitconnect/api/exceptions/RestApiException.java b/api/src/main/java/dev/fitko/fitconnect/api/exceptions/RestApiException.java index e788e13a8..bbefe15ed 100644 --- a/api/src/main/java/dev/fitko/fitconnect/api/exceptions/RestApiException.java +++ b/api/src/main/java/dev/fitko/fitconnect/api/exceptions/RestApiException.java @@ -2,7 +2,7 @@ package dev.fitko.fitconnect.api.exceptions; public class RestApiException extends RuntimeException { - private int statusCode = 400; + private int statusCode = 500; public RestApiException(final String errorMessage, final Throwable error) { super(errorMessage, error); diff --git a/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java b/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java index ed13273fd..c6a280a40 100644 --- a/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java +++ b/core/src/main/java/dev/fitko/fitconnect/core/http/HttpClient.java @@ -64,7 +64,7 @@ public class HttpClient { try (Response response = this.httpClient.newCall(request).execute()) { return this.evaluateStatusAndRespond(response, responseType); } catch (IOException exception) { - throw new RestApiException("HTTP GET call to '" + url + "' failed.", exception, 500); + throw new RestApiException("HTTP GET call to '" + url + "' failed.", exception); } } @@ -88,7 +88,7 @@ public class HttpClient { } } catch (IOException exception) { - throw new RestApiException("HTTP POST call to '" + url + "' failed.", exception, 500); + throw new RestApiException("HTTP POST call to '" + url + "' failed.", exception); } } @@ -112,7 +112,7 @@ public class HttpClient { } } catch (IOException exception) { - throw new RestApiException("HTTP PUT call to '" + url + "' failed.", exception, 500); + throw new RestApiException("HTTP PUT call to '" + url + "' failed.", exception); } } -- GitLab