feat(fe/app): add global error listener
This commit is contained in:
parent
9d7a681552
commit
4fb6dd79a3
1 changed files with 15 additions and 7 deletions
|
@ -2,13 +2,21 @@ import * as React from "react";
|
||||||
import * as ReactDOM from "react-dom";
|
import * as ReactDOM from "react-dom";
|
||||||
|
|
||||||
import { StateMgr } from "./components/state_mgr";
|
import { StateMgr } from "./components/state_mgr";
|
||||||
|
import { ErrorLogger } from "./common/log_error";
|
||||||
|
import { errCorsScript } from "./common/errors";
|
||||||
|
|
||||||
// import "./theme/reset.css";
|
window.onerror = (
|
||||||
// import "./theme/white.css";
|
msg: string,
|
||||||
// TODO: it fails in jest preprocessor now
|
source: string,
|
||||||
// import "./theme/style.css";
|
lineno: number,
|
||||||
// import "./theme/desktop.css";
|
colno: number,
|
||||||
// import "./theme/color.css";
|
error: Error
|
||||||
|
) => {
|
||||||
|
const lowerMsg = msg.toLowerCase();
|
||||||
|
if (lowerMsg.indexOf("script error") > -1) {
|
||||||
|
ErrorLogger().error(errCorsScript, "Check Browser Console for Detail");
|
||||||
|
}
|
||||||
|
ErrorLogger().error(`${source}:${lineno}:${colno}: ${error.toString()}`, "");
|
||||||
|
};
|
||||||
|
|
||||||
ReactDOM.render(<StateMgr />, document.getElementById("mount"));
|
ReactDOM.render(<StateMgr />, document.getElementById("mount"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue