Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions femonitor-sdk/src/error/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,36 @@ export default function error () {
paths: e.path.map((item) => item.tagName).filter(Boolean),
pageURL: getPageURL()
})
} else {
const { message, lineno, colno, error, filename: url } = e
lazyReportCache({
msg: message,
line: lineno,
column: colno,
error: error.stack,
subType: "js",
pageURL: url,
type: "error",
startTime: performance.now()
})
}
},
true
)

// 监听 js 错误
window.onerror = (msg, url, line, column, error) => {
lazyReportCache({
msg,
line,
column,
error: error.stack,
subType: "js",
pageURL: url,
type: "error",
startTime: performance.now()
})
}
// window.onerror = (msg, url, line, column, error) => {
// lazyReportCache({
// msg,
// line,
// column,
// error: error.stack,
// subType: "js",
// pageURL: url,
// type: "error",
// startTime: performance.now()
// })
// }

// 监听 promise 错误 缺点是获取不到列数据
window.addEventListener("unhandledrejection", (e) => {
Expand Down