Fix error rendering while ServerException
This commit is contained in:
parent
5fbe780ef5
commit
161f8b5bf9
|
@ -109,7 +109,11 @@ class Handler extends ExceptionHandler
|
|||
|
||||
if ($exception instanceof ServerException)
|
||||
{
|
||||
return $this->errorResponse($exception->getMessage(),Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$errorBody = $exception->getResponse()->getBody()->getContents();
|
||||
$error = json_decode($errorBody);
|
||||
$message = $error ? $error->error : $exception->getMessage();
|
||||
$code = $error ? $error->status : Response::HTTP_INTERNAL_SERVER_ERROR;
|
||||
return $this->errorResponse($message,$code);
|
||||
}
|
||||
|
||||
if( env('APP_DEBUG', false))
|
||||
|
|
|
@ -115,6 +115,7 @@ $app->register(App\Providers\AuthServiceProvider::class);
|
|||
//$app->register(SMartins\PassportMultiauth\Providers\MultiauthServiceProvider::class);
|
||||
$app->register(Laravel\Passport\PassportServiceProvider::class);
|
||||
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
|
||||
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
"license": "MIT",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"php": "^8.0",
|
||||
"ext-json": "*",
|
||||
"dusterio/lumen-passport": "^0.3.0",
|
||||
"flipbox/lumen-generator": "^9.2",
|
||||
"guzzlehttp/guzzle": "^7.3",
|
||||
"laravel/lumen-framework": "^8.0",
|
||||
"ext-json": "*"
|
||||
"laravel/lumen-framework": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue