Merge pull request 'Update 'app/Exceptions/Handler.php'' (#136) from dev into master

Reviewed-on: WillaEngine-Project/WillaEngine#136
BE.addEventListener
azizi 3 years ago
commit b61f7a3ad8

@ -6,6 +6,8 @@ use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
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;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
@ -54,7 +56,10 @@ class Handler extends ExceptionHandler
{ {
if ($exception instanceof ValidationErrorException) { if ($exception instanceof ValidationErrorException) {
return response()->json(Responser::error($exception->getMessageBody(), $exception->getMessageInfo()), 422); return response()->json(Responser::error($exception->getMessageBody(), $exception->getMessageInfo()), 422);
} elseif ($exception instanceof SiteBannedException) {
return response()->view('webBuilder::errors.template_disabled', ['error' => 'business banned']);
} }
return parent::render($request, $exception); return parent::render($request, $exception);
} }
} }

Loading…
Cancel
Save