App\Traits\RestExceptionHandlerTrait::getJsonResponseForException PHP Метод

getJsonResponseForException() защищенный Метод

Create a new JSON response based on exception type.
protected getJsonResponseForException ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\JsonResponse
$request Illuminate\Http\Request
$e Exception
Результат Illuminate\Http\JsonResponse
    protected function getJsonResponseForException(Request $request, Exception $e)
    {
        if ($e instanceof HttpException) {
            if ($e->getStatusCode() == 401) {
                return $this->unauthorized();
            } elseif ($e->getStatusCode() == 404) {
                return $this->notFound();
            } elseif ($e->getStatusCode() < 500) {
                return $this->badRequest();
            } else {
                return $this->internalError();
            }
        } else {
            return $this->internalError();
        }
    }