Created
November 27, 2013 12:26
-
-
Save mishak87/7674859 to your computer and use it in GitHub Desktop.
getsentry.com + nette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace <secret> and <id> with your API key DSN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... autoload and stuff | |
/** | |
* Really stupid handler that takes first argument that is instance of an exception | |
*/ | |
Nette\Diagnostics\Debugger::$onFatalError[] = $errorHandler = function () { | |
static $client = NULL; | |
$e = NULL; | |
foreach (func_get_args() as $arg) { | |
if ($arg instanceof Exception) { | |
$e = $arg; | |
break; | |
} | |
} | |
if ($e !== NULL) { | |
if ($client === NULL) { | |
$client = new Raven_Client('https://<secret>@app.getsentry.com/<id>'); | |
} | |
$client->captureException($e); | |
} | |
}; | |
// ... $configurator->enableDebugger(__DIR__ . '/../log'); ... | |
// ... $container = $configurator->createContainer(); | |
$container->application->onError[] = $errorHandler; | |
// ... soldier on ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment