Skip to content

Commit

Permalink
Merge pull request #73 from bowphp/5.x-ref-update
Browse files Browse the repository at this point in the history
[5.x] Fix error handler
  • Loading branch information
papac authored May 16, 2023
2 parents 1e1cbf0 + 8cc6911 commit 9ad43a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 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
10 changes: 0 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
},
"require": {
"php": "^8.1",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-pdo_pgsql": "*",
"ext-pdo_sqlite": "*",
"ext-redis": "*",
"ext-xml": "*",
"bowphp/framework": "^5.0",
"bowphp/meta-manager": "^1.0",
"bowphp/policier": "^2.1"
Expand Down

0 comments on commit 9ad43a2

Please sign in to comment.