SpringBoot2로 Rest api 만들기(7) – MessageSource를 이용한 Exception 처리

This commit is contained in:
kimyonghwa
2019-04-14 01:29:03 +09:00
parent f17ec807b5
commit 6d7c846b88
8 changed files with 106 additions and 13 deletions

View File

@@ -52,11 +52,11 @@ public class ResponseService {
return result;
}
// 실패 결과만 처리하는 메소드
public CommonResult getFailResult() {
public CommonResult getFailResult(int code, String msg) {
CommonResult result = new CommonResult();
result.setSuccess(false);
result.setCode(CommonResponse.FAIL.getCode());
result.setMsg(CommonResponse.FAIL.getMsg());
result.setCode(code);
result.setMsg(msg);
return result;
}
// 결과 모델에 api 요청 성공 데이터를 세팅해주는 메소드