Skip to content

Commit 3c877e1

Browse files
committed
Add error types option
According to my pull request: getsentry/sentry-php#369 With this error types options its possible to configure which error types should be reported.
1 parent 29da61e commit 3c877e1

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,12 @@ sentry:
112112
skip_capture:
113113
- "Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface"
114114
```
115+
116+
### error types
117+
118+
Define which error types should be reported.
119+
120+
```yaml
121+
sentry:
122+
error_types: E_ALL & ~E_DEPRECATED & ~E_NOTICE
123+
```

src/Sentry/SentryBundle/DependencyInjection/Configuration.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function getConfigTreeBuilder()
3434
->scalarNode('dsn')
3535
->defaultNull()
3636
->end()
37+
->scalarNode('error_types')
38+
->defaultNull()
39+
->end()
3740
->scalarNode('exception_listener')
3841
->defaultValue('Sentry\SentryBundle\EventListener\ExceptionListener')
3942
->end()

src/Sentry/SentryBundle/ErrorTypesParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function convertErrorConstants($expression)
5656

5757
/**
5858
* Let PHP compute the prepared expression for us.
59-
*
59+
*
6060
* @param string $expression prepared expression e.g. 32767&~8192&~8
6161
* @return int computed expression e.g. 24567
6262
*/

src/Sentry/SentryBundle/Resources/config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
sentry.client:
33
class: '%sentry.client%'
4-
arguments: ['%sentry.dsn%']
4+
arguments: ['%sentry.dsn%', {'errro_types': '%sentry.error_types%'}]
55
calls:
66
- [setRelease, ['%sentry.release%']]
77
- [setEnvironment, ['%sentry.environment%']]

src/Sentry/SentryBundle/SentrySymfonyClient.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ class SentrySymfonyClient extends \Raven_Client
66
{
77
public function __construct($dsn=null, $options=array())
88
{
9+
if (array_key_exists('error_types', $options)) {
10+
$exParser = new ErrorTypesParser($options['error_types']);
11+
$options['error_types'] = $ex->parse();
12+
}
13+
914
$options['sdk'] = array(
1015
'name' => 'sentry-symfony',
1116
'version' => SentryBundle::VERSION,

0 commit comments

Comments
 (0)