Handle the exception provided.

@param Exception $e

@throws RuntimeException

@return \Tobscure\JsonApi\Exception\Handler\ResponseBag
519175
public function handle(Exception $e)
    {
        foreach ($this->handlers as $handler) {
            if ($handler->manages($e)) {
                return $handler->handle($e);
            }
        }

        throw new RuntimeException('Exception handler for '.get_class($e).' not found.');
    }
267240
public function exceptionHandler($e) {
        if (method_exists($e, 'getType')) {
            $this->addError($e->getMessage(), $e->getFile(), $e->getLine(), $e->getType());
        }
        else {
            $this->addError($e->getMessage(), $e->getFile(), $e->getLine(), gettype($e));
        }
    }
407601
public function exception($e)
    {
        $this->setParams(
            $e->getCode(),
            $e->getMessage(),
            $e->getFile(),
            $e->getLine(),
            $e->getTraceAsString());

        return $this->render();
    }
429358
public function logException(\Exception $e)
    {
        $error = $e->getMessage() . $e->getTraceAsString();
        return $this->logEmergency($error);
    }
460645
public function handleException($e)
    {
        if (!$e instanceof Exception) {
            $e = new FatalThrowableError($e);
        }

        try {
            $trace = call_user_func(config()->get('exception.log'), $e);
        } catch (Exception $exception) {
            $trace = [
                'original' => explode("\n", $e->getTraceAsString()),
                'handler' => explode("\n", $exception->getTraceAsString()),
            ];
        }

        logger()->log(Logger::ERROR, $e->getMessage(), $trace);

        if (Application::MODE_CLI === $this->mode) {
            throw $e;
        }

        $status = ($e instanceof HttpException) ? $e->getStatusCode() : $e->getCode();

        if (!array_key_exists($status, Response::$statusTexts)) {
            $status = Response::HTTP_INTERNAL_SERVER_ERROR;
        }

        $resposne = json(call_user_func(config()->get('exception.response'), $e), $status);
        if (!$this->isBooted()) {
            $this->handleResponse($resposne);
        }

        return $resposne;
    }
1226854
public function handleException($e)
    {
        if (!$e instanceof Exception) {
            $e = new FatalThrowableError($e);
        }

        $this->getExceptionHandler()->report($e);
        $this->getExceptionHandler()->render($e);
    }
1285459
private function _exceptionHandler($e)
    {
        $this->_errorController->setParams(array('e' => $e));
        $action = FrontController::EXCEPTION_HANDLER_ACTION . 'Action';
        $this->_response->setStatusCode(500);

        return $this->_errorController->$action();
    }
1086682
public function handle(\Exception $e)
    {
        //by default set LOGIC ERROR
        $type = \Eden\Core\Exception::LOGIC;
        $level = \Eden\Core\Exception::ERROR;
        $offset = 1;
        $reporter = get_class($e);

        $trace = $e->getTrace();
        $message = $e->getMessage();

        //if the exception is an eden exception
        if ($e instanceof \Eden\Core\Exception) {
            //set type and level from that
            $trace = $e->getRawTrace();

            $type = $e->getType();
            $level = $e->getLevel();
            $offset = $e->getTraceOffset();
            $reporter = $e->getReporter();
        }

        $this->trigger(
            'exception',
            $type,
            $level,
            $reporter,
            $e->getFile(),
            $e->getLine(),
            $message,
            $trace,
            $offset
        );
    }
267048
public function addException(\Exception $e)
    {
        if ($this->initialized && $this->enabled()) {
            $this->debugbar['exceptions']->addException($e);
        }

        return $this;
    }
760107
public function throw_exception($e=null)
    {
        $e = $e ?: new \Exception();

        foreach ($this->policies as $policy) {
            $policy->check_method_throws($this->className, $this->methodName, $e, true);
        }

        $this->will(function () use ($e) {
            throw $e;
        });

        return $this;
    }
202315
private function handleExternalError(\Exception $e) {
        $reflection = new \ReflectionClass($e);
        echo '<header>';
            echo '<h1>Exception: ' . $reflection->getName() . '</h1>';
            echo '<h2>Message: ' . $e->getMessage() . '</h2>';
            echo '<h3>' . $e->getFile() . ':' . $e->getLine() . '</h3>';
        echo '</header>';
        if ( method_exists($e, 'getContext') ) {
            echo 'Debug:';
            !d( $e->getContext() );
        }
    }
921208
private function getJsonException(\Exception $e)
    {
        $file = Path::makeRelative($e->getFile(), $this->app['path_resolver']->resolve('root'));

        $error = [
            'error' => [
                'type'    => get_class($e),
                'file'    => $file,
                'line'    => $e->getLine(),
                'message' => $e->getMessage(),
            ],
        ];

        return new JsonResponse($error, Response::HTTP_INTERNAL_SERVER_ERROR);
    }
980500
protected function runHandlers($e)
    {
        /** @var \League\BooBoo\Handler\HandlerInterface $handler */
        foreach (array_reverse($this->handlerStack) as $handler) {
            $handledException = $handler->handle($e);
            if ($handledException instanceof \Exception) {
                $e = $handledException;
            }
        }

        return $e;
    }
1073310
protected function handleValidationException(Exception $e)
    {
        // Get the status code and build the message.
        $statusCode = 422;
        $message = $e->getMessage();
        $errorData = $e->getResponse()->getData();

        return $this->generateResponse('errors', $errorData, $statusCode, Status::FAIL, $message);
    }
1016695
public function handle(Exception $e)
    {
        $this->exception = $e;
        $this->notify($e);
        return $this->record($e);
    }
327085
public function report(Exception $e)
    {
        if ($this->shouldntReport($e)) {
            return;
        }

        if (is_callable($reportCallable = [$e, 'report'])) {
            return $this->container->call($reportCallable);
        }

        try {
            $logger = $this->container->make(LoggerInterface::class);
        } catch (Exception $ex) {
            throw $e;
        }

        $logger->error(
            $e->getMessage(),
            array_merge($this->context(), ['exception' => $e]
        ));
    }
340649
public function handleException($e)
    {
        if (!$e instanceof Exception) { // Since PHP 7, in addition to an Exception, an internal Error may occur.
            // Convert the Error to ErrorException
            $e = new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); // @codeCoverageIgnore
        } // @codeCoverageIgnore

        $this->getExceptionHandler()->handle($e);
    }