diff --git a/backend/src/main/java/heartbeat/client/decoder/BuildKiteFeignClientDecoder.java b/backend/src/main/java/heartbeat/client/decoder/BuildKiteFeignClientDecoder.java index 8bd0415a0e..c7706925ae 100644 --- a/backend/src/main/java/heartbeat/client/decoder/BuildKiteFeignClientDecoder.java +++ b/backend/src/main/java/heartbeat/client/decoder/BuildKiteFeignClientDecoder.java @@ -11,26 +11,14 @@ public class BuildKiteFeignClientDecoder implements ErrorDecoder { @Override public Exception decode(String methodKey, Response response) { - String errorMessage = ""; - switch (methodKey) { - case "getTokenInfo": - errorMessage = "Failed to get token info"; - break; - case "getBuildKiteOrganizationsInfo": - errorMessage = "Failed to get BuildKite OrganizationsInfo info"; - break; - case "getPipelineInfo": - errorMessage = "Failed to get pipeline info"; - break; - case "getPipelineSteps": - errorMessage = "Failed to get pipeline steps"; - break; - case "getPipelineStepsInfo": - errorMessage = "Failed to get pipeline steps info"; - break; - default: - break; - } + String errorMessage = switch (methodKey) { + case "getTokenInfo" -> "Failed to get token info"; + case "getBuildKiteOrganizationsInfo" -> "Failed to get BuildKite OrganizationsInfo info"; + case "getPipelineInfo" -> "Failed to get pipeline info"; + case "getPipelineSteps" -> "Failed to get pipeline steps"; + case "getPipelineStepsInfo" -> "Failed to get pipeline steps info"; + default -> "Failed to get buildkite info"; + }; log.error("Failed to get BuildKite info_response status: {}, method key: {}", response.status(), methodKey); HttpStatus statusCode = HttpStatus.valueOf(response.status()); diff --git a/backend/src/main/java/heartbeat/client/decoder/GitHubFeignClientDecoder.java b/backend/src/main/java/heartbeat/client/decoder/GitHubFeignClientDecoder.java index 92d10d9796..a71b1c8b57 100644 --- a/backend/src/main/java/heartbeat/client/decoder/GitHubFeignClientDecoder.java +++ b/backend/src/main/java/heartbeat/client/decoder/GitHubFeignClientDecoder.java @@ -11,26 +11,14 @@ public class GitHubFeignClientDecoder implements ErrorDecoder { @Override public Exception decode(String methodKey, Response response) { - String errorMessage = ""; - switch (methodKey) { - case "verifyToken": - errorMessage = "Failed to verify token"; - break; - case "verifyCanReadTargetBranch": - errorMessage = "Failed to verify canRead target branch"; - break; - case "getCommitInfo": - errorMessage = "Failed to get commit info"; - break; - case "getPullRequestCommitInfo": - errorMessage = "Failed to get pull request commit info"; - break; - case "getPullRequestListInfo": - errorMessage = "Failed to get pull request list info"; - break; - default: - break; - } + String errorMessage = switch (methodKey) { + case "verifyToken" -> "Failed to verify token"; + case "verifyCanReadTargetBranch" -> "Failed to verify canRead target branch"; + case "getCommitInfo" -> "Failed to get commit info"; + case "getPullRequestCommitInfo" -> "Failed to get pull request commit info"; + case "getPullRequestListInfo" -> "Failed to get pull request list info"; + default -> "Failed to get github info"; + }; log.error("Failed to get GitHub info_response status: {}, method key: {}", response.status(), methodKey); HttpStatus statusCode = HttpStatus.valueOf(response.status()); diff --git a/backend/src/main/java/heartbeat/client/decoder/JiraFeignClientDecoder.java b/backend/src/main/java/heartbeat/client/decoder/JiraFeignClientDecoder.java index ab9bc4c1da..8af55eed41 100644 --- a/backend/src/main/java/heartbeat/client/decoder/JiraFeignClientDecoder.java +++ b/backend/src/main/java/heartbeat/client/decoder/JiraFeignClientDecoder.java @@ -11,32 +11,16 @@ public class JiraFeignClientDecoder implements ErrorDecoder { @Override public Exception decode(String methodKey, Response response) { - String errorMessage = ""; - switch (methodKey) { - case "getJiraBoardConfiguration": - errorMessage = "Failed to get jira board configuration"; - break; - case "getColumnStatusCategory": - errorMessage = "Failed to get column status category"; - break; - case "getJiraCards": - errorMessage = "Failed to get jira cards"; - break; - case "getJiraCardHistoryByCount": - errorMessage = "Failed to get jira card history by count"; - break; - case "getTargetField": - errorMessage = "Failed to get target field"; - break; - case "getBoard": - errorMessage = "Failed to get board"; - break; - case "getProject": - errorMessage = "Failed to get project"; - break; - default: - break; - } + String errorMessage = switch (methodKey) { + case "getJiraBoardConfiguration" -> "Failed to get jira board configuration"; + case "getColumnStatusCategory" -> "Failed to get column status category"; + case "getJiraCards" -> "Failed to get jira cards"; + case "getJiraCardHistoryByCount" -> "Failed to get jira card history by count"; + case "getTargetField" -> "Failed to get target field"; + case "getBoard" -> "Failed to get board"; + case "getProject" -> "Failed to get project"; + default -> "Failed to get jira info"; + }; log.error("Failed to get Jira info_response status: {}, method key: {}", response.status(), methodKey); HttpStatus statusCode = HttpStatus.valueOf(response.status());