protected function _startErrorHandler()
    {
        $this->_whoops = new Run();
        $environment = $this->getConfiguration()
            ->get('environment', 'production');

        switch ($environment) {
            case 'production':
                $handler = new Production();
                $handler->setApplication($this);
                break;

            default:
                $handler = new PrettyPageHandler();
        }

        $this->_whoops->pushHandler($handler);

        $this->_whoops->register();
        return $this;
    }