Skip to content

Commit

Permalink
Refactoring errors handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
papac committed Sep 22, 2023
1 parent 3bbf5f1 commit b740413
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/Exceptions/ErrorHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ class ErrorHandle extends BaseErrorHandler
* handle the error
*
* @param Exception $exception
* @return mixed
*/
public function handle($exception): mixed
public function handle($exception)
{
if (request()->isAjax()) {
return $this->json($exception);
}

if ($exception instanceof ModelNotFoundException || $exception instanceof HttpException) {
if (
$exception instanceof ModelNotFoundException
|| $exception instanceof HttpException
) {
$code = $exception->getStatusCode();
$source = $this->render('errors.' . $code, [
return $this->render('errors.' . $code, [
'code' => 404,
'exception' => $exception
]);

return $source;
}

if ($exception instanceof HttpResponseException) {
Expand Down

0 comments on commit b740413

Please sign in to comment.