[KC-99] 추론관리 등록 수정, 모델 조회 추가

This commit is contained in:
2026-01-09 17:51:35 +09:00
parent 40f2b09e0c
commit aba878d845
7 changed files with 137 additions and 28 deletions

View File

@@ -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());

View File

@@ -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;
}
}
}