[KC-99] 추론관리 등록 수정, 모델 조회 추가
This commit is contained in:
@@ -487,22 +487,13 @@ public class GlobalExceptionHandler {
|
||||
this.errorLog(request, e);
|
||||
String codeName = e.getCodeName();
|
||||
HttpStatus status = e.getStatus();
|
||||
// String message = e.getMessage() == null ? ApiResponseCode.getMessage(codeName) :
|
||||
// e.getMessage();
|
||||
//
|
||||
// ApiResponseCode apiCode = ApiResponseCode.getCode(codeName);
|
||||
//
|
||||
// ErrorLogEntity errorLog =
|
||||
// saveErrorLogData(
|
||||
// request, apiCode, status, ErrorLogDto.LogErrorLevel.WARNING, e.getStackTrace());
|
||||
//
|
||||
// ApiResponseDto<String> body =
|
||||
// ApiResponseDto.createException(apiCode, message, status, errorLog.getId());
|
||||
|
||||
ApiResponseCode responseCode = ApiResponseCode.from(codeName, status);
|
||||
|
||||
ErrorLogEntity errorLog =
|
||||
saveErrorLogData(
|
||||
request,
|
||||
ApiResponseCode.getCode(codeName),
|
||||
responseCode,
|
||||
HttpStatus.valueOf(status.value()),
|
||||
ErrorLogDto.LogErrorLevel.WARNING,
|
||||
e.getStackTrace());
|
||||
|
||||
@@ -194,5 +194,26 @@ public class ApiResponseDto<T> {
|
||||
public static String getMessage(String name) {
|
||||
return ApiResponseCode.valueOf(name.toUpperCase()).getText();
|
||||
}
|
||||
|
||||
public static ApiResponseCode from(String codeName, HttpStatus status) {
|
||||
|
||||
if (codeName != null && !codeName.isBlank()) {
|
||||
try {
|
||||
return ApiResponseCode.valueOf(codeName.toUpperCase());
|
||||
} catch (IllegalArgumentException ignore) {
|
||||
// fallback
|
||||
}
|
||||
}
|
||||
|
||||
if (status != null) {
|
||||
try {
|
||||
return ApiResponseCode.valueOf(status.name());
|
||||
} catch (IllegalArgumentException ignore) {
|
||||
// fallback
|
||||
}
|
||||
}
|
||||
|
||||
return INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user