AI 캐릭터 등록/수정 API의 오류 메시지 표시 추가
This commit is contained in:
@@ -124,7 +124,7 @@ class AdminChatCharacterController(
|
|||||||
// 외부 API 호출 전 DB에 동일한 이름이 있는지 조회
|
// 외부 API 호출 전 DB에 동일한 이름이 있는지 조회
|
||||||
val existingCharacter = service.findByName(request.name)
|
val existingCharacter = service.findByName(request.name)
|
||||||
if (existingCharacter != null) {
|
if (existingCharacter != null) {
|
||||||
throw SodaException(messageKey = "admin.chat.character.duplicate_name")
|
throw SodaException("동일한 이름은 등록이 불가능합니다: ${request.name}")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 외부 API 호출
|
// 1. 외부 API 호출
|
||||||
@@ -244,7 +244,10 @@ class AdminChatCharacterController(
|
|||||||
return apiResponse.data?.id ?: throw SodaException(messageKey = "admin.chat.character.register_failed_no_id")
|
return apiResponse.data?.id ?: throw SodaException(messageKey = "admin.chat.character.register_failed_no_id")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
throw SodaException(messageKey = "admin.chat.character.register_failed_retry")
|
throw SodaException(
|
||||||
|
message = e.message,
|
||||||
|
messageKey = "admin.chat.character.register_failed_retry"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +264,10 @@ class AdminChatCharacterController(
|
|||||||
metadata = metadata
|
metadata = metadata
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw SodaException(messageKey = "admin.chat.character.image_save_failed")
|
throw SodaException(
|
||||||
|
message = e.message,
|
||||||
|
messageKey = "admin.chat.character.image_save_failed"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,13 +313,19 @@ class AdminChatCharacterController(
|
|||||||
// 외부 API로 전달할 변경이 있을 때만 외부 API 호출(3가지 필드만 변경된 경우는 호출하지 않음)
|
// 외부 API로 전달할 변경이 있을 때만 외부 API 호출(3가지 필드만 변경된 경우는 호출하지 않음)
|
||||||
if (hasChangedData) {
|
if (hasChangedData) {
|
||||||
val chatCharacter = service.findById(request.id)
|
val chatCharacter = service.findById(request.id)
|
||||||
?: throw SodaException(messageKey = "admin.chat.character.not_found")
|
?: throw SodaException(
|
||||||
|
message = "해당 ID의 캐릭터를 찾을 수 없습니다: ${request.id}",
|
||||||
|
messageKey = "admin.chat.character.not_found"
|
||||||
|
)
|
||||||
|
|
||||||
// 이름이 수정된 경우 DB에 동일한 이름이 있는지 확인
|
// 이름이 수정된 경우 DB에 동일한 이름이 있는지 확인
|
||||||
if (request.name != null && request.name != chatCharacter.name) {
|
if (request.name != null && request.name != chatCharacter.name) {
|
||||||
val existingCharacter = service.findByName(request.name)
|
val existingCharacter = service.findByName(request.name)
|
||||||
if (existingCharacter != null) {
|
if (existingCharacter != null) {
|
||||||
throw SodaException(messageKey = "admin.chat.character.duplicate_name")
|
throw SodaException(
|
||||||
|
message = "동일한 이름은 등록이 불가능합니다: ${request.name}",
|
||||||
|
messageKey = "admin.chat.character.duplicate_name"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +462,10 @@ class AdminChatCharacterController(
|
|||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
throw SodaException(messageKey = "admin.chat.character.update_failed_retry")
|
throw SodaException(
|
||||||
|
message = e.message,
|
||||||
|
messageKey = "admin.chat.character.update_failed_retry"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user