Report or log an exception.

@param  \Exception  $e
@return mixed

@throws \Exception
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]
        ));
    }
1016695
public function handle(Exception $e)
    {
        $this->exception = $e;
        $this->notify($e);
        return $this->record($e);
    }
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;
    }
25028
protected function returnException(Exception $e)
    {
        $key = snake_case(class_basename($e));
        $message = $this->translate($key, $e->getMessage());

        return new ExceptionReply($message, [], $e);
    }
817806
public function report(Exception $e)
    {
        try {
            $this->manager->trackException($e);
        }
        catch (Exception $exception) {
            // ignore
        }

        $this->illuminateHandler->report($e);
    }
913692
public function buildErrorResponse(\Exception $e)
  {
    $response = [ 
        'type' => get_class($e),
        'code' => $e->getCode(),
        'message' => $e->getMessage(),
        'data' => [
            'status' => 500
        ]
    ];

    if ($e instanceof ModelNotFoundException) {
        $response['data']['status'] = 404;
    }

    if ($e instanceof HttpException) {
        $response['data']['status'] = $e->getStatusCode();
    }

    if ($e instanceof ValidationException) {
        $response['data']['errors'] = $e->messages();
    }

    if ($this->isDebugMode()) {
        $response['line'] = $e->getLine();
        $response['file'] = $e->getFile();
        $response['trace'] = $e->getTraceAsString();
    }

    return $response;
  }
98751
public function exception($e) {
        $type = "system";
        if (isset($_GET['type'])) {
            $type = $_GET['type'];
        }
        switch ($type) {
        case 'dapi':
        case 'api':
            $this->exception[] = $e;
            break;
        case 'page':
        default:
            require __DIR__ . '/exception.php';
            break;
        }
    }
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;
	}
1230389
protected function handleException(Exception $e)
    {
        // if ($e instanceof MethodNotAllowedException) {
        //     $handler = 'notAllowedHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e->getAllowedMethods()];
        // } elseif ($e instanceof NotFoundException) {
        //     $handler = 'notFoundHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e];
        // } elseif ($e instanceof SlimException) {
        //     // This is a Stop exception and contains the response
        //     return $e->getResponse();
        // } else {
            // Other exception, use $request and $response params
            $handler = 'errorHandler';
            $params = [$e];
        // }

        if ($this->getContainer()->has($handler)) {
            $callable = $this->getContainer()->get($handler);
            // Call the registered handler
            return call_user_func_array($callable, $params);
        }

        // No handlers found, so just display simple error
        $this->displayError($e->getMessage());
        exit($e->getCode() ?: 1);
    }
774613
public function report(Exception $e)
    {
        if ($this->shouldReport($e)) {
            $this->event->fire(new ExceptionEvent($e));
        }
        parent::report($e);
    }
1047008
protected function error(\Exception $e)
    {
        $str  = sprintf("Message: %s\r\n", $e->getMessage());
        $str .= sprintf("Code: %s\r\n", $e->getCode());
        $str .= sprintf("File: %s (line: %s)\r\n", $e->getFile(), $e->getLine());
        $str .= sprintf("Trade: %s\r\n", $e->getTraceAsString());

        if ($this->log instanceof \Closure)
        {
            $log = $this->log;
            $log($str);
        }
    }
831336
protected function buildFromException(\Exception $e)
    {
        $rs = [
            'return' => false, 'status' => 500,
            'exception' => [
                'msg'  => $e->getMessage(),
                'code' => $e->getCode(),
                'file' => $e->getFile(),
                'line' => $e->getLine(),
            ],
        ];

        return $this->packResult($rs);
    }
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;

	}
166931
public function report(Exception $e)
	{
		if ($this->shouldntReport($e)) return;

		$this->log->error((string) $e);
	}
444215
public function report($e)
    {
        if ($e instanceof Throwable) {
            $e = $this->throwableToException($e);
        }
        
        if ($this->shouldntReport($e)) {
            return;
        }
        
        app('Psr\Log\LoggerInterface')->error((string) $e);
    }
51082
public function report( Exception $e )
	{
		if ( !$this->shouldReport( $e ) )
			return;

		try
		{
			$logger = Framework::log();
		}
		catch ( Exception $ex )
		{
			throw $e; // throw the original Exception
		}

		$logger->error( $e );


		$level = $this->getLevel( $e );
		$id = UniversalBuilder::resolveClass( ExceptionIdentifier::class )->identify( $e );

		$logger->{$level}( $e, ['identification' => ['id' => $id]] );
	}
479349
public function formatException(\Exception $e) {
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->writeElement('class', get_class($e));
        $xml->writeElement('message', htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8'));
        $xml->writeElement('file', htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8'));
        $xml->writeElement('line', $e->getLine());
        $xml->writeElement('trace', htmlspecialchars($e->getTraceAsString(), ENT_QUOTES, 'UTF-8'));

        return $xml->outputMemory();
    }