3
3
namespace Tools \Error \Middleware ;
4
4
5
5
use Cake \Core \Configure ;
6
+ use Cake \Datasource \Exception \RecordNotFoundException ;
6
7
use Cake \Error \Middleware \ErrorHandlerMiddleware as CoreErrorHandlerMiddleware ;
7
8
use Cake \Log \Log ;
9
+ use Cake \Network \Exception \BadRequestException ;
10
+ use Cake \Network \Exception \MethodNotAllowedException ;
11
+ use Cake \Network \Exception \NotAcceptableException ;
12
+ use Cake \Network \Exception \NotFoundException ;
8
13
9
14
/**
10
15
* Error handling middleware.
30
35
*/
31
36
class ErrorHandlerMiddleware extends CoreErrorHandlerMiddleware {
32
37
38
+ /**
39
+ * @var array
40
+ */
41
+ public static $ blacklist = [
42
+ NotFoundException::class,
43
+ MethodNotAllowedException::class,
44
+ NotAcceptableException::class,
45
+ RecordNotFoundException::class,
46
+ BadRequestException::class,
47
+ 'Cake\Network\Exception\GoneException ' ,
48
+ 'Cake\Network\Exception\ConflictException ' ,
49
+ 'Cake\Network\Exception\InvalidCsrfToken ' ,
50
+ 'Cake\Network\Exception\UnauthorizedException ' ,
51
+ 'Cake\Routing\Exception\MissingControllerException ' ,
52
+ 'Cake\Routing\Exception\MissingActionException ' ,
53
+ 'Cake\Routing\Exception\PrivateActionException ' ,
54
+ 'Cake\Routing\Exception\NotFoundException ' ,
55
+ ];
56
+
33
57
/**
34
58
* @param string|callable|null $renderer The renderer or class name
35
59
* to use or a callable factory.
@@ -53,21 +77,7 @@ public function __construct($renderer = null, array $config = []) {
53
77
* @return void
54
78
*/
55
79
protected function logException ($ request , $ exception ) {
56
- $ blacklist = [
57
- 'Cake\Routing\Exception\MissingControllerException ' ,
58
- 'Cake\Routing\Exception\MissingActionException ' ,
59
- 'Cake\Routing\Exception\PrivateActionException ' ,
60
- 'Cake\Routing\Exception\NotFoundException ' ,
61
- 'Cake\Datasource\Exception\RecordNotFoundException ' ,
62
- 'Cake\Network\Exception\MethodNotAllowedException ' ,
63
- 'Cake\Network\Exception\BadRequestException ' ,
64
- 'Cake\Network\Exception\ForbiddenException ' ,
65
- 'Cake\Network\Exception\GoneException ' ,
66
- 'Cake\Network\Exception\ConflictException ' ,
67
- 'Cake\Network\Exception\InvalidCsrfToken ' ,
68
- 'Cake\Network\Exception\UnauthorizedException ' ,
69
- 'Cake\Network\Exception\NotAcceptableException ' ,
70
- ];
80
+ $ blacklist = static ::$ blacklist ;
71
81
if (isset ($ this ->_config ['log404 ' ])) {
72
82
$ blacklist = $ this ->_config ['log404 ' ];
73
83
}
0 commit comments