shortcut for returns(throws($e))

@api
@param   \Throwable  $e
@return  $this
@since   3.2.0
12935
public function throws(\Throwable $e): self
    {
        $this->callMap = new CallMap(['function' => throws($e)]);
        return $this;
    }
898058
public static Throwable getCause(Throwable e) {
        Throwable cause = null; 
        Throwable result = e;
        while (null != (cause = result.getCause()) && (result != cause)) {
            result = cause;
        }
        return result;
    }
672976
public function serializeThrowable(Throwable $e)
    {
        $this->class = get_class($e);
        $this->message = $e->getMessage();

        $this->properties = [];

        try {
            $reflection = new ReflectionClass($this->class);

            foreach ($reflection->getProperties() as $property) {
                if ($property->isStatic()) {
                    continue;
                }

                $property->setAccessible(true);

                $name = $property->getName();

                if ($name == 'trace') {
                    continue;
                }

                $value = $property->getValue($e);

                $this->properties[$name] = Maker::make($value);
            }
        } catch (Throwable $ex) {
            //
        }
    }
257898
protected function handleException($passable, Exception $e)
    {
        if (! $this->container->bound(ExceptionHandlerContract::class) ||
            ! $passable instanceof DataProviderContract) {
            throw $e;
        }

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

        $handler->report($e);

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

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

        return $response;
    }
209466
public function setException(exception $e)
    {
        if (isset($this->response)) {
            $this->response->setException($e);
        } else {
            throw $e;
        }
    }
986584
protected function createErrorPage(\Throwable $e){
        $response   = $this->factory->createResponse(
            $e instanceof HttpStatus ? $e->getStatusCode() : 500
        );

        if($e instanceof \Fratily\Http\Message\Status\MethodNotAllowed){
            $response   = $response->withHeader(
                "Allow",
                implode(", ", $e->getAllowed())
            );
        }

        return $response;
    }
1245937
protected function catchException(\Exception $e)
    {
        foreach ($this->onException as $call) {
            call_user_func_array($call, [$e]);
        }

        throw $e;
    }
741941
protected function getErrorReason(\Throwable $e)
    {
        $reason = null;
        switch (true) {
            /* beStrictAboutOutputDuringTests="true" */
            case $e instanceof OutputError:
                $reason = 'No output during test';
                break;
            /* checkForUnintentionallyCoveredCode="true" */
            case $e instanceof UnintentionallyCoveredCodeError:
                $reason = 'Executed code must be defined with @covers and @uses annotations';
                break;
            default:
                if (preg_match('#\-\-\- Global variables before the test#', $e->getMessage())) {
                    /* beStrictAboutChangesToGlobalState="true" (no specific exception) for globals */
                    $reason = 'No global variable manipulation during test';
                } elseif (preg_match('#\-\-\- Static attributes before the test#', $e->getMessage())) {
                    /* beStrictAboutChangesToGlobalState="true" (no specific exception) for static var */
                    /* Only when beStrictAboutChangesToGlobalState="true" */
                    $reason = 'No static attribute manipulation during test';
                } elseif (preg_match('#This test did not perform any assertions#', $e->getMessage())) {
                    /* beStrictAboutTestsThatDoNotTestAnything="true" (no specific exception) */
                    $reason = 'No test that do not test anything';
                } elseif (preg_match('#Trying to @cover or @use not existing #', $e->getMessage())) {
                    /* forceCoversAnnotation="true" (no specific exception) */
                    $reason = 'Only executed code must be defined with @covers and @uses annotations';
                }
                break;
        }
        return $reason;
    }
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);
    }
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();
    }
751404
public function output( \Throwable $e )
    {
        $out = '';

        $out .= self::LOG_EOL;
        $out .= "* Exception Stack *" . self::LOG_EOL;
        $out .= "-------------------------------------------------------------" . self::LOG_EOL;

        $no = 1;
        $backtrace = NULL;
        while( $e )
        {
            if (!$backtrace && $e instanceof CalgamoException){
                $backtrace = $e->getBackTraceList();
            }
            
            // get exception info
            $clazz = get_class($e);
            $file = $e->getFile();
            $line = $e->getLine();
            $message = $e->getMessage();

            // print exception info
            $out .= "[$no]$clazz" . self::LOG_EOL;
            $out .= "   $file($line)" . self::LOG_EOL;
            $out .= "   $message" . self::LOG_EOL;

            // move to previous exception
            $e = method_exists( $e, 'getPrevious' ) ? $e->getPrevious() : NULL;
            $no ++;
            if ( $e ){
                $out .= self::LOG_EOL;
            }
        }

        if ( $backtrace === NULL || !is_array($backtrace) ){
            $backtrace = debug_backtrace();
        }

        $out .= self::LOG_EOL;
        $out .= "* Call Stack *" . self::LOG_EOL;
        $out .= "-------------------------------------------------------------" . self::LOG_EOL;

        // print backtrace
        $call_no = 0;
        foreach( $backtrace as $element ){
            $klass = isset($element['class']) ? $element['class'] : '';
            $func  = isset($element['function']) ? $element['function'] : '';
            $type  = isset($element['type']) ? $element['type'] : '';
            $args  = isset($element['args']) ? $element['args'] : array();
            $file  = isset($element['file']) ? $element['file'] : '';
            $line  = isset($element['line']) ? $element['line'] : '';

            $args_disp = '';
            foreach( $args as $arg ){
                if ( strlen($args_disp) > 0 ){
                    $args_disp .= ',';
                }
                $args_disp .= Util::toString($arg);
            }

            if ( $call_no > 0 ){
                $out .= self::LOG_EOL;
            }
            $out .= "[$call_no]{$klass}{$type}{$func}($args_disp)" . self::LOG_EOL;
            $out .= "   {$file}($line)" . self::LOG_EOL;

            $call_no ++;
        }
    
        // additional debugtrace
        if ($this->additional)
        {
            $title = $this->additional->getAdditionalInfoTitle();
        
            $out .= PHP_EOL;
            $out .= "* {$title} *" . PHP_EOL;
            $out .= "-------------------------------------------------------------" . PHP_EOL;
        
            $this->additional->renderAdditionalInfo( $e, $out );
        }
    
        return $out;
    }
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();
    }
112396
public function render($e)
    {
        if ($e instanceof Throwable) {
            $e = $this->throwableToException($e);
        }
        
        if ($this->shouldntBacktrace($e)) {
            return with(new ExceptionHandler(env('APP_DEBUG')))->handle($e);
        }
        
        return with(new SymfonyExceptionHandler(env('APP_DEBUG')))->handle($e);
    }
1129877
protected function handleViewException($e)
	{
		$e = new \ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e);

		ob_get_clean(); throw $e;
	}
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;
    }
368779
public function handleException( \Throwable $e ) : bool
    {
        if ( $e instanceof HttpStatusException )
        {
            // Show HTTP error document
            $html = $this->provider->getErrorDocument( $e->getStatusCode() );
            
            // output html
            echo $html;

            return true;
        }

        return false;
    }
303217
public function throw_($e)
    {
        $this->validateValidity();
        try {
            $this->g->throw($e);
            return;
        } catch (\Throwable $e) {} catch (\Exception $e) {}
        $this->e = $e;
    }