Added client error reports
This commit is contained in:
parent
299bba5e14
commit
bb80359432
@ -85,6 +85,7 @@ export default class AnimeNotifier {
|
||||
document.addEventListener("DOMContentLoaded", this.onContentLoaded.bind(this))
|
||||
document.addEventListener("keydown", this.onKeyDown.bind(this), false)
|
||||
window.addEventListener("popstate", this.onPopState.bind(this))
|
||||
window.addEventListener("error", this.onError.bind(this))
|
||||
|
||||
// Idle
|
||||
requestIdleCallback(this.onIdle.bind(this))
|
||||
@ -1024,4 +1025,19 @@ export default class AnimeNotifier {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// This is called every time an uncaught JavaScript error is thrown
|
||||
onError(evt: ErrorEvent) {
|
||||
let report = {
|
||||
message: evt.message,
|
||||
stack: evt.error.stack,
|
||||
fileName: evt.filename,
|
||||
lineNumber: evt.lineno,
|
||||
columnNumber: evt.colno,
|
||||
}
|
||||
|
||||
this.post("/api/new/clienterrorreport", report)
|
||||
.then(() => console.log("Successfully reported the error to the website staff."))
|
||||
.catch(() => console.warn("Failed reporting the error to the website staff."))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user