src/Application.php
public static function handleException(\Throwable $e)
    {
        $app = self::getInstance();
        if ($app->request === null)
            $app->request = Request::createFromGlobals();

        $req = $app->request;

        try
        {
            // Try to form a good looking response
            if (!Request::cli())
            {
                $mgr = $app->resolver;
                $res = $mgr->getResolver('template');
                $assets = $mgr->getResolver('assets');
                $amgr = new AssetManager($assets);

                $tpl = new Template($res, $amgr, $req);
                $tpl->setExceptionTemplate($e);

                $tpl->assign('exception', $e);
                $tpl->assign('request', $req);
                $tpl->assign('dev', $app->dev);
                $app->i18n;

                $response = $tpl->renderReturn();
                $responder = new \Wedeto\HTTP\Responder();
                $result = new \Wedeto\HTTP\Result();
                $result->setResponse($response);
                $responder->setRequest($req);
                $responder->setResult($result);

                // Inject CSS/JS
                $params = new Dictionary(['responder' => $responder, 'mime' => 'text/html']);
                $amgr->executeHook($params);

                $responder->respond();
            }
        }
        catch (\Throwable $e2)
        {
            echo "<h1>Error while showing error template:</h1>\n\n";
            echo "<pre>" . WF::html($e2) . "</pre>\n";
        }

        if (Request::cli())
        {
            fprintf(STDERR, \Wedeto\Application\CLI\ANSI::bright("An uncaught exception has occurred:") . "\n\n");
            WF::debug(WF::str($e));
        }
        else
        {
            echo "<h2>Original error:</h2>\n\n";
            echo "<pre>" . WF::html($e) . "</pre>\n";
        }
    }
public static function handleException(\Throwable $e)
    {
        $app = self::getInstance();
        if ($app->request === null)
            $app->request = Request::createFromGlobals();

        $req = $app->request;

        try
        {
            // Try to form a good looking response
            if (!Request::cli())
            {
                $mgr = $app->resolver;
                $res = $mgr->getResolver('template');
                $assets = $mgr->getResolver('assets');
                $amgr = new AssetManager($assets);

                $tpl = new Template($res, $amgr, $req);
                $tpl->setExceptionTemplate($e);

                $tpl->assign('exception', $e);
                $tpl->assign('request', $req);
                $tpl->assign('dev', $app->dev);
                $app->i18n;

                $response = $tpl->renderReturn();
                $responder = new \Wedeto\HTTP\Responder();
                $result = new \Wedeto\HTTP\Result();
                $result->setResponse($response);
                $responder->setRequest($req);
                $responder->setResult($result);

                // Inject CSS/JS
                $params = new Dictionary(['responder' => $responder, 'mime' => 'text/html']);
                $amgr->executeHook($params);

                $responder->respond();
            }
        }
        catch (\Throwable $e2)
        {
            echo "<h1>Error while showing error template:</h1>\n\n";
            echo "<pre>" . WF::html($e2) . "</pre>\n";
        }

        if (Request::cli())
        {
            fprintf(STDERR, \Wedeto\Application\CLI\ANSI::bright("An uncaught exception has occurred:") . "\n\n");
            WF::debug(WF::str($e));
        }
        else
        {
            echo "<h2>Original error:</h2>\n\n";
            echo "<pre>" . WF::html($e) . "</pre>\n";
        }
    }
public static function handleException ( \ Throwable $ e ) { $ app = self :: getInstance ( ) ; if ( $ app -> request === null ) $ app -> request = Request :: createFromGlobals ( ) ; $ req = $ app -> request ; try { // Try to form a good looking response if ( ! Request :: cli ( ) ) { $ mgr = $ app -> resolver ; $ res = $ mgr -> getResolver ( 'template' ) ; $ assets = $ mgr -> getResolver ( 'assets' ) ; $ amgr = new AssetManager ( $ assets ) ; $ tpl = new Template ( $ res , $ amgr , $ req ) ; $ tpl -> setExceptionTemplate ( $ e ) ; $ tpl -> assign ( 'exception' , $ e ) ; $ tpl -> assign ( 'request' , $ req ) ; $ tpl -> assign ( 'dev' , $ app -> dev ) ; $ app -> i18n ; $ response = $ tpl -> renderReturn ( ) ; $ responder = new \ Wedeto \ HTTP \ Responder ( ) ; $ result = new \ Wedeto \ HTTP \ Result ( ) ; $ result -> setResponse ( $ response ) ; $ responder -> setRequest ( $ req ) ; $ responder -> setResult ( $ result ) ; // Inject CSS/JS $ params = new Dictionary ( [ 'responder' => $ responder , 'mime' => 'text/html' ] ) ; $ amgr -> executeHook ( $ params ) ; $ responder -> respond ( ) ; } } catch ( \ Throwable $ e2 ) { echo "<h1>Error while showing error template:</h1>\n\n" ; echo "<pre>" . WF :: html ( $ e2 ) . "</pre>\n" ; } if ( Request :: cli ( ) ) { fprintf ( STDERR , \ Wedeto \ Application \ CLI \ ANSI :: bright ( "An uncaught exception has occurred:" ) . "\n\n" ) ; WF :: debug ( WF :: str ( $ e ) ) ; } else { echo "<h2>Original error:</h2>\n\n" ; echo "<pre>" . WF :: html ( $ e ) . "</pre>\n" ; } }
The exception handler is called whenever an uncaught exception occurs.

This will send a notification to the user that something went wrong,
attempting to format this as fancy as possible given the circumstances.

@param Throwable $e The exception that wasn't caught elsewhere
The exception handler is called whenever an uncaught exception occurs .