浏览代码

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
 ### 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).
 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.
 In that case you are having invalid links in your pages somewhere, which should be fixed.