static function catchException($exception)
    {
        $str = '';
        if ($exception instanceof \ErrorException) {
            $str .= static::severity2string($exception->getSeverity()) . ': ';
        }
        $str .= $exception->__toString();
        if (ini_get('display_errors')) {
            echo $str . "\n\n";
        }
        if (ini_get('log_errors')) {
            error_log($str);
        }
    }