Skip to content

Instantly share code, notes, and snippets.

@ArnaudLigny
Last active March 22, 2016 09:12
Show Gist options
  • Save ArnaudLigny/6080029 to your computer and use it in GitHub Desktop.
Save ArnaudLigny/6080029 to your computer and use it in GitHub Desktop.
Magento Whoops (https://github.com/filp/whoops) integration.
<?php
[...]
/**
* Redeclare custom error handler
* with Whoops support
* @see https://github.com/filp/whoops
*
* @param string $handler
* @return Mage_Core_Model_App
*/
public function setErrorHandler($handler)
{
if(Mage::getIsDeveloperMode()) {
$run = new Whoops\Run;
$handler = new Whoops\Handler\PrettyPageHandler;
$handler->addDataTable(
'Magento', array(
'Version' => Mage::getVersion()
)
);
$run->pushHandler($handler);
$run->register();
}
else {
set_error_handler($handler);
}
return $this;
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment