Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Using Whoops Error Handler

$
0
0
Hi,

I've manage to installed Whoops in CI 3 using composer, with addition to index.php like so.

Code:
switch (ENVIRONMENT)
{
    case 'development':
        error_reporting(-1);
        ini_set('display_errors', 1);
        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);

        $whoops = new \Whoops\Run;
        $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
        $whoops->register();

                throw new Exception('whoops handler test'); // For testing purpose
        break;

    case 'testing':
                // Omitted
        break;

    case 'production':
                // Omitted
        break;

    default:
                // Omitted
        exit(1);
}

It works when there is an error or exception in index.php, but when error occurred in Controller or Model. CI standard error handler is still used, anyone ever successfully installed Whoops?

Viewing all articles
Browse latest Browse all 14114


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>