From e8506e5a079d2a1bf2d640b11f5958f3825ceb35 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 Oct 2022 17:05:05 +1100 Subject: [PATCH] Improve error handling of illegal relation loading --- app/Exceptions/Handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 276ed694ff..9e439a815e 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -198,7 +198,7 @@ class Handler extends ExceptionHandler // nlog($exception->validator->getMessageBag()); return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422); } elseif ($exception instanceof RelationNotFoundException && $request->expectsJson()) { - return response()->json(['message' => $exception->getMessage()], 400); + return response()->json(['message' => "Relation `{$exception->relation}` is not a valid include."], 400); } elseif ($exception instanceof GenericPaymentDriverFailure && $request->expectsJson()) { return response()->json(['message' => $exception->getMessage()], 400); } elseif ($exception instanceof GenericPaymentDriverFailure) {