Update 'app/Exceptions/Handler.php'

pull/137/head
azizi 3 years ago
parent 8213e289a7
commit aeafb60f0c

@ -2,13 +2,13 @@
namespace App\Exceptions; namespace App\Exceptions;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
use WM\Core\Exceptions\HasRelationException;
use WM\Core\Exceptions\ValidationErrorException; use WM\Core\Exceptions\ValidationErrorException;
use WM\Core\Services\Responser; use WM\Core\Services\Responser;
use WM\WebBuilder\Exceptions\SiteBannedException; use WM\WebBuilder\Exceptions\SiteBannedException;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
@ -58,6 +58,8 @@ class Handler extends ExceptionHandler
return response()->json(Responser::error($exception->getMessageBody(), $exception->getMessageInfo()), 422); return response()->json(Responser::error($exception->getMessageBody(), $exception->getMessageInfo()), 422);
} elseif ($exception instanceof SiteBannedException) { } elseif ($exception instanceof SiteBannedException) {
return response()->view('webBuilder::errors.template_disabled', ['error' => 'business banned']); return response()->view('webBuilder::errors.template_disabled', ['error' => 'business banned']);
} elseif ($exception instanceof HasRelationException) {
return response()->json(Responser::error([$exception->getMessage()]), 422);
} }
return parent::render($request, $exception); return parent::render($request, $exception);

Loading…
Cancel
Save