Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
add configuration on the silent operator
Browse files Browse the repository at this point in the history
  • Loading branch information
benji07 committed Dec 18, 2014
1 parent 46e196c commit 1540a71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function getConfigTreeBuilder()
->booleanNode('handlePHPErrors')
->defaultValue(false)
->end()
->booleanNode('handleSilentErrors')
->defaultValue(false)
->end()
->arrayNode('ignoredClasses')
->prototype('scalar')
->treatNullLike(array())
Expand Down
6 changes: 4 additions & 2 deletions Listener/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Notifier
private $ignoredClasses;
private $reportWarnings = false;
private $reportErrors = false;
private $reportSilent = false;
private $repeatTimeout = false;

private static $tmpBuffer = null;
Expand All @@ -59,10 +60,11 @@ public function __construct(Swift_Mailer $mailer, EngineInterface $templating, $
$this->handle404 = $config['handle404'];
$this->reportErrors = $config['handlePHPErrors'];
$this->reportWarnings = $config['handlePHPWarnings'];
$this->reportSilent = $config['handleSilentErrors'];
$this->ignoredClasses = $config['ignoredClasses'];
$this->repeatTimeout = $config['repeatTimeout'];
$this->errorsDir = $cacheDir.'/errors';

if (!is_dir($this->errorsDir)) {
mkdir($this->errorsDir);
}
Expand Down Expand Up @@ -136,7 +138,7 @@ public function onKernelRequest(GetResponseEvent $event)
public function handlePhpError($level, $message, $file, $line, $errcontext)
{
// don't catch error with error_repoting is 0
if (0 === error_reporting()) {
if (0 === error_reporting() && false === $this->reportSilent) {
return false;
}

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ elao_error_notifier:
mailer: your.mailer.id # default : mailer
handlePHPErrors: true # catch fatal erros and email them
handlePHPWarnings: true # catch warnings and email them
handleSilentErrors: false # don't catch error on method with an @
ignoredClasses: ~
```
Expand Down

0 comments on commit 1540a71

Please sign in to comment.