Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save beelbrecht/998743ffa91501532f23 to your computer and use it in GitHub Desktop.
Save beelbrecht/998743ffa91501532f23 to your computer and use it in GitHub Desktop.
{
"name": "your/package",
"type": "typo3-flow-package",
// ...
"require": {
"raven/raven": "*"
},
// ...
}
<?php
namespace Your\Package\Error;
/* *
* This script belongs to the TYPO3 Flow package "Your.Package". *
* *
* */
use TYPO3\Flow\Error\ProductionExceptionHandler;
/**
* Production Exception handler that reports exceptions to a configurable Sentry DSN using the raven library
*/
class SentryExceptionHandler extends ProductionExceptionHandler {
/**
* @param \Exception $exception
* @return void
*/
protected function echoExceptionWeb(\Exception $exception) {
if (isset($this->options['sentryDsn']) && strlen($this->options['sentryDsn']) > 0) {
$ravenClient = new \Raven_Client($this->options['sentryDsn']);
$ravenClient->captureException($exception);
}
parent::echoExceptionWeb($exception);
}
}
TYPO3:
Flow:
error:
exceptionHandler:
className: 'Your\Package\Error\SentryExceptionHandler'
# Sentry DSN (e.g. "http://public:secret@example.com/1")
'sentryDsn': ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment