From 1f4d2f1e4a0452754d6408aea3bbef6e84bb10c7 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 5 Jul 2023 14:27:10 +0100 Subject: [PATCH 1/2] Properly return SCIM Exceptions --- app/Exceptions/Handler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 3b1ffb9b31..e89bffcb90 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -75,7 +75,8 @@ class Handler extends ExceptionHandler // Handle SCIM exceptions if ($e instanceof SCIMException) { - return response()->json(Helper::formatStandardApiResponse('error', null, 'Invalid SCIM Request'), 400); + return $e->render($request); + //return response()->json(Helper::formatStandardApiResponse('error', null, 'Invalid SCIM Request'), 400); } // Handle standard requests that fail because Carbon cannot parse the date on validation (when a submitted date value is definitely not a date) From a6a89ddd6c89c52bd04931a6c0734e48b4160d67 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 5 Jul 2023 14:31:08 +0100 Subject: [PATCH 2/2] Also log(debug) the error - could be useful for troubleshooting --- app/Exceptions/Handler.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e89bffcb90..3d4db93452 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -75,8 +75,12 @@ class Handler extends ExceptionHandler // Handle SCIM exceptions if ($e instanceof SCIMException) { - return $e->render($request); - //return response()->json(Helper::formatStandardApiResponse('error', null, 'Invalid SCIM Request'), 400); + try { + $e->report(); // logs as 'debug', so shouldn't get too noisy + } catch(\Exception $reportException) { + //do nothing + } + return $e->render($request); // ALL SCIMExceptions have the 'render()' method } // Handle standard requests that fail because Carbon cannot parse the date on validation (when a submitted date value is definitely not a date)