Skip to content

Commit

Permalink
Add the application exception
Browse files Browse the repository at this point in the history
  • Loading branch information
papac committed May 16, 2023
1 parent 1d0f921 commit 8cc6911
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions app/Exceptions/ErrorHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
use Exception;
use PDOException;
use Bow\Http\Exception\HttpException;
use Bow\Router\Exception\RouterException;
use Policier\Exception\TokenExpiredException;
use Policier\Exception\TokenInvalidException;
use Bow\Application\Exception\BaseErrorHandler;
use Bow\Http\Exception\ResponseException as HttpResponseException;
use Bow\Database\Exception\NotFoundException as ModelNotFoundException;

class ErrorHandle
class ErrorHandle extends BaseErrorHandler
{
/**
* handle the error
*
* @param Exception $exception
* @return void
* @return mixed
*/
public function handle(Exception $exception)
public function handle($exception): mixed
{
if (request()->isAjax()) {
return $this->json($exception);
Expand All @@ -41,23 +41,6 @@ public function handle(Exception $exception)
}
}

/**
* Render view as response
*
* @param string $view
* @param array $data
* @return mixed
*/
private function render($view, $data = [], $code = 200)
{
if (is_numeric($data)) {
$code = $data;
$data = [];
}

return view($view, $data, $code);
}

/**
* Send the json as response
*
Expand Down

0 comments on commit 8cc6911

Please sign in to comment.