createActionException.

@param \Exception $e Throwed exception

@return Response|RedirectResponse
337161
protected function createActionException(\Exception $e)
    {
        $this->handleException($e);

        return new RedirectResponse($this->admin->generateUrl('list'));
    }
592114
protected function createException(GuzzleRequestException $exception): RequestException
    {
        if ($exception instanceof GuzzleResponseException) {
            return new ResponseException(
                $exception->getRequest(),
                $exception->getResponse(),
                $exception
            );
        }

        throw new RequestException(
            $exception->getRequest(),
            $exception
        );
    }
571886
public function routeError(\Exception $e)
    {
        if ($e instanceof NotFoundHttpException) {
            $responseContent = $this->twig()->render('Default\404.twig');
            $response = new Response($responseContent, 404);
        } else {
            $responseContent = $this->twig()->render('Default\500.twig', array('error' => $e->getMessage()));
            $response = new Response($responseContent, 500);
        }

        return $response;
    }
784080
public function handleException(\Exception $e)
	{
        $environment = $this->core->getCurrentDomain()->environment;
		
		if(isset($this->core->getSettings()->errorhandling->controller->$environment) === true) {
			$controller = FrameworkUtils::stringToClassName($this->core->getSettings()->errorhandling->controller->$environment);

			$pc = new $controller->className($this->core, $this->core->getHttpRequest(), new Route());

			$httpResponse = call_user_func(array($pc, $controller->methodName), $e);
		} else {
			$content = null;

			$httpErrorCode = ($e instanceof HttpException)?$e->getCode():500;
			$exceptionStr = null;

			if($this->core->getSettings()->core->environments->$environment->debug === true) {
				$exceptionStr = "\n<pre>";

				$exceptionStr .= '<b>Uncaught exception' . "\n" . '==================</b>' . "\n";
				$exceptionStr .= 'Type: ' . get_class($e) . "\n";
				$exceptionStr .= 'Message: ' . $e->getMessage() . ' (Code: ' . $e->getCode() . ')' . "\n";
				$exceptionStr .= 'Thrown in: ' . $e->getFile() . ' (Line: ' . $e->getLine() . ")\n\n";

				$exceptionStr .= $e->getTraceAsString();

				$exceptionStr .= '</pre>';
			}

			$errorStr = $httpErrorCode . ' ' . HttpResponse::getHttpStatusString($httpErrorCode);
			$content = "<!doctype html>\n<html>\n<head>\n<title>" . $errorStr . "</title>\n</head>\n<body>\n<h1>" . $errorStr . "</h1>" . $exceptionStr . "\n</body>\n</html>";

			$httpResponse = new HttpResponse($httpErrorCode, $content);
		}

		$httpResponse->send();

		exit;
	}
787510
protected function renderException(Request $request, Exception $e)
    {
        return $this->app['Nano7\Foundation\Contracts\Exception\ExceptionHandler']->render($request, $e);
    }
672746
public function render($request, Exception $e)
    {
        $transformed = $this->getTransformed($e);

        $response = $e instanceof Responsable ? $e->toResponse($request) : null;

        if (!$response && ($e instanceof OldHttpResponseException || $e instanceof NewHttpResponseException)) {
            $response = $e->getResponse();
        }

        if (!$response instanceof SymfonyResponse) {
            try {
                $response = $this->getResponse($request, $e, $transformed);
            } catch (Throwable $e) {
                $this->report($e instanceof Exception ? $e : new FatalThrowableError($e));

                $response = new Response('Internal server error.', 500, ['Content-Type' => 'text/plain']);
            }
        }

        return $this->toIlluminateResponse($response, $transformed);
    }
874689
public static function fromException(\Exception $e): self
    {
        return new self($e->getMessage(), $e->getCode(), $e);
    }
418490
public static function createFromException(\Exception $e, $http_status = Response::STATUS_ERROR)
    {
        return new Error(
            $e->getMessage(),
            $http_status,
            $e->getFile(),
            $e->getLine(),
            $e
        );
    }
215871
protected function convertExceptionToResponse(Exception $e)
    {
        return SymfonyResponse::create(
            $this->renderExceptionContent($e),
            $this->isHttpException($e) ? $e->getStatusCode() : 500,
            $this->isHttpException($e) ? $e->getHeaders() : []
        );
    }
572493
protected function doException(\Exception $e)
    {
        $output = (new ResponseInjector)->build();

        $errorController = (new Injector)->param('errorController');
        $errorAction = (new Injector)->param('errorAction');

        if (!$errorController || !$errorAction) { // render SAPI error not configured
            $stream = $output->getBody();
            $stream->write('Option `errorController` or `errorAction` not configured');

            return $output->withBody($stream);
        }

        // Render SAPI error
        $body = (new RequestInjector)->build()->getParsedBody();
        $body['error'] = $e;

        $request = (new RequestInjector)->build()->withParsedBody($body);
        (new Injector)->addRequirement('request', $request);

        $controller = $errorController;

        /** @var \Micro\Mvc\Controllers\IController $result */
        $result = new $controller(false);
        $result = $result->action($errorAction);

        if ($result instanceof ResponseInterface) {
            return $result;
        }

        $stream = $output->getBody();
        $stream->write((string)$result);

        return $output->withBody($stream);
    }
1237517
protected function handleError(\Exception $e) {
		$kernel = $this->getDefaultKernel();
		$application = $this->getDefaultApplication($kernel);

		$kernel->getResponse()->addValue("error", $e->getMessage());
		$this->logger->logError($e->getMessage());

		return $application;
	}
1205883
public function getRedirect(RouteException $e) {
    $redirect = $this->getConfig('redirect', $e);
    if (empty($redirect)) {
      $redirect = '<current>';
    }
    return Url::fromUri("internal:/{$redirect}")->toString();
  }
835076
protected function convertExceptionToServiceException(Exception $e): ServiceException
    {
        $exception = get_class($e);
        $conversion = $this->container['config']->get('exception.conversion', []);

        if (isset($conversion[$exception])) {
            return new $conversion[$exception]($e->getMessage(), $e->getCode(), $e);
        } /*else if (in_array($exception, $conversion, true)) {
            return new ServiceException($e->getMessage(), 400, $e);
        }*/ else {
            $statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 400;

            return new ServiceException($e->getMessage(), $statusCode, $e);
        }
    }
887840
public function render($request, Exception $e)
    {
        if (method_exists($e, 'render') && $response = $e->render($request)) {
            return Router::toResponse($request, $response);
        } elseif ($e instanceof Responsable) {
            return $e->toResponse($request);
        }

        $e = $this->prepareException($e);

        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } elseif ($e instanceof AuthenticationException) {
            return $this->unauthenticated($request, $e);
        } elseif ($e instanceof ValidationException) {
            return $this->convertValidationExceptionToResponse($e, $request);
        }

        return $request->expectsJson()
                        ? $this->prepareJsonResponse($request, $e)
                        : $this->prepareResponse($request, $e);
    }
808489
protected function convertExceptionToResponse(Exception $e)
    {
        $e = FlattenException::create($e);
        $handler = new SymfonyExceptionHandler(DEBUG);
        echo $handler->getHtml($e);
    }
160482
public static function render(Exception $e)
    {
        switch ($e->message) {
            case 1:
                $return = redirect()->back()->withErrors(['Not enough arguments provided']);
                break;
            case 2:
                $return = redirect()->back()->withErrors(['Object or argument is not valid']);
                break;
            case 3:
                $return = redirect()->back()->withErrors(["Object doesn't exist"]);
                break;
            case 4:
                $return = redirect()->back()->withErrors(['Object already exists']);
                break;
            case 5:
                $return = redirect()->back()->withErrors(['Object is suspended']);
                break;
            case 6:
                $return = redirect()->back()->withErrors(['Object is already unsuspended']);
                break;
            case 7:
                $return = redirect()->back()->withErrors(["Object can't be deleted because is used by the other object"]);
                break;
            case 8:
                $return = redirect()->back()->withErrors(['Object cannot be created because of hosting package limits']);
                break;
            case 9:
                $return = redirect()->back()->withErrors(['Wrong password']);
                break;
            case 10:
                $return = redirect()->back()->withErrors(['Object cannot be accessed be the user']);
                break;
            case 11:
                $return = redirect()->back()->withErrors(['Subsystem is disabled']);
                break;
            case 12:
                $return = redirect()->back()->withErrors(['Configuration is broken']);
                break;
            case 13:
                $return = redirect()->back()->withErrors(['Not enough disk space to complete the action']);
                break;
            case 14:
                $return = redirect()->back()->withErrors(['Server is to busy to complete the action']);
                break;
            case 15:
                $return = redirect()->back()->withErrors(['Connection failed. Host is unreachable']);
                break;
            case 16:
                $return = redirect()->back()->withErrors(['FTP server is not responding']);
                break;
            case 17:
                $return = redirect()->back()->withErrors(['Database server is not responding']);
                break;
            case 18:
                $return = redirect()->back()->withErrors(['RRDtool failed to update the database']);
                break;
            case 19:
                $return = redirect()->back()->withErrors(['Update operation failed']);
                break;
            case 20:
                $return = redirect()->back()->withErrors(['Service restart failed']);
                break;
            default:
                $return = redirect()->back()->withErrors([$e->getMessage()]);
        }

        return $return;
    }
52461
protected function getErrorResponse(Exception $e)
    {
        switch (get_class($e)) {
            case ForbiddenException::class:
                $response = $this->forbidden(
                    new ErrorBag([new Error('Forbidden', $e->getMessage())])
                );
                break;
            default:
                $response = $this->errorResponse(
                    new ErrorBag([new Error('Bad Request', 'Request could not be served.')])
                );
        }

        return $response;
    }