fix: ApiResponse에서 ValidationException 422 처리 추가
- Service에서 ValidationException::withMessages() 사용 시 500 에러 발생 버그 수정 - ValidationException을 422 상태 코드로 적절히 처리 - errors 필드에 검증 에러 상세 포함 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -246,6 +246,15 @@ public static function handle(
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
// ValidationException - 422 Unprocessable Entity
|
||||
if ($e instanceof \Illuminate\Validation\ValidationException) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => __('error.validation_failed'),
|
||||
'errors' => $e->errors(),
|
||||
], 422);
|
||||
}
|
||||
|
||||
// 품목 코드 중복 예외 - duplicate_id, duplicate_code 포함
|
||||
if ($e instanceof DuplicateCodeException) {
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user