From 494bdd19dad9f8a593a43213a14009a6774850f4 Mon Sep 17 00:00:00 2001 From: kent Date: Tue, 6 Jan 2026 19:12:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20ApiResponse=EC=97=90=EC=84=9C=20Validati?= =?UTF-8?q?onException=20422=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Service에서 ValidationException::withMessages() 사용 시 500 에러 발생 버그 수정 - ValidationException을 422 상태 코드로 적절히 처리 - errors 필드에 검증 에러 상세 포함 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Helpers/ApiResponse.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Helpers/ApiResponse.php b/app/Helpers/ApiResponse.php index 4a6f506..230f262 100644 --- a/app/Helpers/ApiResponse.php +++ b/app/Helpers/ApiResponse.php @@ -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([