デバッグモード用のエラーページ描画用のレスポンスインスタンスを生成する

@param   \Throwable  $e

@return  ResponseInterface
5158
protected function createErrorPageInDebugMode(\Throwable $e){
        $response   = $this->createErrorPage($e);
        $context    = [
            "errors"    => [],
        ];

        do{
            $context["errors"][]    = $this->analysisError($e);
        }while(($e = $e->getPrevious()) !== null);

        $response->getBody()->write($this->twig->render("error.twig", $context));

        return $response;
    }
339521
protected function handleException($passable, Exception $e)
    {
        if (! $this->container->bound(ExceptionHandler::class) ||
            ! $passable instanceof Request) {
            throw $e;
        }

        $handler = $this->container->make(ExceptionHandler::class);

        $handler->report($e);

        $response = $handler->render($passable, $e);

        if (method_exists($response, 'withException')) {
            $response->withException($e);
        }

        return $response;
    }
355424
protected function prepareResponse(Request $request, Exception $e)
    {
        if ($this->isHttpException($e)) {
            return $this->createResponse($this->renderHttpException($e, $request), $e);
        } else {
            return $this->createResponse($this->convertExceptionToResponse($e, $request), $e);
        }
    }
1062300
public function handleException(Throwable $e): void
    {
        $exceptionHandlerPath = null;

        if (($module = Application::getCurrentModule()) !== null) {
            $exceptionHandlerPath = Application::getModulePath($module) . 'controllers/ExceptionHandler.php';
            if (!is_file($exceptionHandlerPath)) {
                $exceptionHandlerPath = Application::getApplicationPath('controllers/ExceptionHandler.php');
            }
        } else {
            $exceptionHandlerPath = Application::getApplicationPath('controllers/ExceptionHandler.php');
        }

        if (is_file($exceptionHandlerPath)) {
            require_once $exceptionHandlerPath;
            $exceptionHandler = new \ExceptionHandler($e);

            if ($exceptionHandler instanceof ResponseExceptionHandler) {
                $exceptionHandler->exec();
            } else {
                $routeException = new ServerException('Your ExceptionHandler is not instance of ResponseExceptionHandler, can not continue');
                Log::emergency($routeException);
                Application::terminateWithError('Your ExceptionHandler is not instance of ResponseExceptionHandler, can not continue');
            }
        } else {
            $exceptionHandler = new ResponseExceptionHandler($e);
            $exceptionHandler->exec();
        }
    }
1260669
protected function handleForResponseException(
        ServerRequestInterface $request,
        ResponseInterface $response,
        \Throwable $e
    ) : ResponseInterface {
        if ($e instanceof MethodNotAllowedException) {
            $handler = $this->getNotAllowedHandler();
        } elseif ($e instanceof NotFoundException) {
            $handler = $this->getNotFoundHandler();
        } elseif ($e instanceof \Exception) {
            $handler = $this->getExceptionHandler();
        } else {
            $handler = $this->getErrorHandler();
        }

        $response = $handler($request, $response, $e);

        // check if buffer is zero and add the buffer
        if (ob_get_level() === 0) {
            $this->addCreateBuffer();
        }

        return $response;
    }
1283326
protected function _getException(\Throwable $e, $h1)
	{
		try
		{
			return $this->_getFormatterStrategy()->format($e, $h1);
		}
		catch (\Throwable $e2)
		{
			return "Error '" . get_class($e2) . "' during processing of exception '" . get_class($e) . "' with message '{$e2->getMessage()}'.";
		}
	}
1016063
public function handleException(\Throwable $e) : void
    {
        $this->report($e);
        if ($this->getConfigParam('env') != 'prod') {
            throw $e;
        }
        $response = $this->throwableToResponse($e);
        $this->responseSender->sendResponse($response);
    }
669783
public function exceptionHandler(\Throwable $exception)
    {
        if ($exception instanceof ResponseCode) {
            try {
                $out = $this->render($exception->getCode(), [], $exception->display());
            } catch (\Throwable $exception) {
                return $this->exceptionHandler($exception);
            }

            // debug on dev / display trace
            if (!(AbstractApp::env() != AbstractApp::PRODUCTION && ob_get_length() > 0)) {
                self::response()->addHeader('Content-Type', $this->getErrorContentType());
            }

            self::response()->setStatus($exception->getCode());
            self::response()->setBody($out);
            HttpApp::instance()->end();
        } else {
            Handler::log($exception);

            if (AbstractApp::env() != AbstractApp::PRODUCTION) {
                Handler::exceptionHandler($exception);
            } else {
                $throw = new ResponseCode($exception->getMessage(), 500, $exception);
                $this->exceptionHandler($throw);
            }
        }

        return true;
    }
407601
public function exception($e)
    {
        $this->setParams(
            $e->getCode(),
            $e->getMessage(),
            $e->getFile(),
            $e->getLine(),
            $e->getTraceAsString());

        return $this->render();
    }
1236282
protected function makeResponse(int $status, $content, ?\Throwable $e = null): ResponseInterface
    {
        $exceptionMarker = (2 != intval($status / 100));

        if ($exceptionMarker && Core::env('TESTING')) {

            $logData = [$content, $status];
            is_null($e) ?: $logData[] = $e->getTraceAsString();
            Core::get('Logger')->info($logData);

            if (!is_array($content)) {
                $content = ['message' => $content];
            }

            return new JsonResponse($content, $status);
        }

        if($exceptionMarker) {
            $content = [];

        } elseif (!is_array($content)) {
            if (is_object($content)) {
                $content = get_object_vars($content);
            } else {
                $content = ['data' => $content];
            }
        }

        return new JsonResponse($content, $status);
    }
867985
protected function prepareException(Exception $e)
    {
        $e = parent::prepareException($e);

        if ($e instanceof MethodNotAllowedHttpException) {
            $e = new HttpException(405, 'Method not allowed', $e->getPrevious(), $e->getHeaders(), $e->getCode());
        }

        return $e;
    }
12935
public function throws(\Throwable $e): self
    {
        $this->callMap = new CallMap(['function' => throws($e)]);
        return $this;
    }
862838
protected function handleViewException( Throwable $e )
	{
		$e = new ErrorException( $this->getMessage( $e ), 0, 1, $e->getFile(), $e->getLine(), $e );

		parent::handleViewException( $e );
	}
1167634
public static function exceptionHandler(\Exception $e)
    {
//echo __METHOD__;
        $error = Error::createFromException($e, Response::STATUS_ERROR);
        $status = method_exists($e, 'getStatus') ? $e->getStatus() : Response::STATUS_ERROR;
        Container::get('response')
            ->setStatus($status);
        Container::get('controller')
            ->addError($error)
            ->serve();
    }
1002705
public function handleException(\Throwable $e)
	{
        // headers sent by browser are prefixed with 'HTTP' (so that they don't mess with environment variables), and - are replaced by _
        if ( (strpos($_SERVER['HTTP_USER_AGENT'], 'XMLHTTP') === 0) || (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') === 0) )
            // if XMLHTTP request
            $this->_handleXMLHTTPCommandException($e);

        // if GET/POST request
        else
            $this->_handleGETPOSTException($e);
        
        die();
    }
890155
public function handleException( \Throwable $e ) : bool
    {
        // Render exception
        $output = $this->renderer->output( $e );
    
        // output
        fwrite(STDERR, $output . PHP_EOL);
    
        return true;
    }
611270
private function exception(ProcessorException $e)
	{

		$data = array(
			'type'    => Type::ERROR,
			'code'    => $e->getCode(),
			'message' => $e->getMessage(),
			'time'    => Time::ts(),
		);
		$this->response = new Response($data, Type::ERROR, null);

		return $this->response;

	}