瀏覽代碼

feat: Prints an error log for errors in child components render methods.

master
Дамян Минков 3 年之前
父節點
當前提交
5c299bcd46
共有 1 個檔案被更改,包括 12 行新增0 行删除
  1. 12
    0
      react/features/base/app/components/BaseApp.js

+ 12
- 0
react/features/base/app/components/BaseApp.js 查看文件

@@ -100,6 +100,18 @@ export default class BaseApp extends Component<*, State> {
100 100
         this.state.store.dispatch(appWillUnmount(this));
101 101
     }
102 102
 
103
+    /**
104
+     * Logs for errors that were not caught.
105
+     *
106
+     * @param {Error} error - The error that was thrown.
107
+     * @param {Object} info - Info about the error(stack trace);.
108
+     *
109
+     * @returns {void}
110
+     */
111
+    componentDidCatch(error: Error, info: Object) {
112
+        logger.error(error, info);
113
+    }
114
+
103 115
     /**
104 116
      * Delays this {@code BaseApp}'s startup until the {@code Storage}
105 117
      * implementation of {@code localStorage} initializes. While the

Loading…
取消
儲存