You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- in `config/config.php` add `\Dot\ErrorHandler\ConfigProvider`
26
+
- in `config/pipeline.php` add `\Dot\ErrorHandler\ErrorHandlerInterface::class`
27
+
- the interface is used as an alias to keep all error handling related configurations in one file
28
+
-**IMPORTANT NOTE** there should be no other error handlers after this one (only before) because the other error handler will catch the error causing dot-errorhandler not to catch any error, we recommend using just one error handler unless you have an error-specific handler
24
29
30
+
- Configure the error handler as shown below
25
31
26
-
* Add the config provider
27
-
- in `config/config.php` add `\Dot\ErrorHandler\ConfigProvider`
28
-
- in `config/pipeline.php` add `\Dot\ErrorHandler\ErrorHandlerInterface::class`
29
-
+ the interface is used as an alias to keep all error handling related configurations in one file
30
-
+**IMPORTANT NOTE** there should be no other error handlers after this one (only before) because the other error handler will catch the error causing dot-errorhandler not to catch any error, we recommend using just one error handler unless you have an error-specific handler
31
-
32
-
* Configure the error handler as shown below
32
+
config/autoload/error-handling.global.php
33
33
34
-
configs/autoload/error-handling.global.php
35
34
```php
36
35
<?php
37
36
@@ -53,20 +52,21 @@ return [
53
52
];
54
53
```
55
54
56
-
When declaring the `ErrorHandlerInterface` alias you can choose whether to log or not:
57
-
* for logging use `LogErrorHandler`
58
-
* for the simple zend expressive handler user `ErrorHandler`
55
+
A configuration example for the default logger can be found in `config/log.global.php.dist`.
56
+
57
+
When declaring the `ErrorHandlerInterface` alias you can choose whether to log or not:
58
+
59
+
- for logging use `LogErrorHandler`
60
+
- for the simple Zend Expressive handler user `ErrorHandler`
59
61
60
62
The class `Dot\ErrorHandler\ErrorHandler` is the same as the Zend Expressive error handling class
61
63
the only difference being the removal of the `final` statement for making extension possible.
62
64
63
-
64
-
The class `Dot\ErrorHandler\LogErrorHandler` is `Dot\ErrorHandler\ErrorHandler` with
65
+
The class `Dot\ErrorHandler\LogErrorHandler` is `Dot\ErrorHandler\ErrorHandler` with
65
66
added logging support.
66
67
67
-
68
-
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declare in the
69
-
package's ConfigProvider. If you need a custom ErrorHandler it must have a factory
68
+
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declared in the
69
+
package's `ConfigProvider`. If you need a custom ErrorHandler it must have a factory
70
70
declared in the config, as in the example.
71
71
72
72
Example:
@@ -98,5 +98,3 @@ return [
98
98
```
99
99
100
100
Config examples can be found in this project's `config` directory.
Register `dot-errorhandler` in you project by adding `Dot\ErrorHandler\ConfigProvider::class` to your configuration aggregator (to `config/config.php` for example),
4
+
and add `\Dot\ErrorHandler\ErrorHandlerInterface::class` (to `config/pipeline.php` for example) **as the outermost layer of the middleware** to catch all Exceptions
0 commit comments