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

ADM-856:[backend]feat: add decode default case error message #1139

Merged
merged 1 commit into from
Mar 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading