ソースを参照

Update ErrorHandler.md

Mark Sch 8 年 前
コミット
d490b993bb
1 ファイル変更23 行追加0 行削除
  1. 23 0
      docs/Error/ErrorHandler.md

+ 23 - 0
docs/Error/ErrorHandler.md

@@ -40,6 +40,29 @@ if ($isCli) {
 }
 ```
 
+Also, if you use the new Application middleware, make sure to include it there:
+```php
+use Cake\Http\BaseApplication;
+// Switch Cake\Error\Middleware\ErrorHandlerMiddleware to
+use Tools\Error\Middleware\ErrorHandlerMiddleware;
+
+class Application extends BaseApplication {
+
+    /**
+     * @param \Cake\Http\MiddlewareQueue $middlewareQueue Middleware queue.
+     *
+     * @return \Cake\Http\MiddlewareQueue The updated middleware queue.
+     */
+    public function middleware($middleware) {
+        $middleware
+            // Replace the core one
+            ->add(new ErrorHandlerMiddleware())
+            ...
+
+        return $middleware;
+    }
+```
+
 ### Tips
 You should also set up a monitor to check for internally caused 404s (referrer is a page on the own site) and alert (via email or alike).
 In that case you are having invalid links in your pages somewhere, which should be fixed.