Added final null checks

This commit is contained in:
2019-04-22 15:59:08 +09:00
parent 70a62f06e5
commit 480ba3a370
8 changed files with 145 additions and 93 deletions

View File

@ -1474,7 +1474,7 @@ export default class AnimeNotifier {
}
// This is called every time an uncaught JavaScript error is thrown
onError(evt: ErrorEvent) {
async onError(evt: ErrorEvent) {
let report = {
message: evt.message,
stack: evt.error.stack,
@ -1483,8 +1483,11 @@ export default class AnimeNotifier {
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."))
try {
await this.post("/api/new/clienterrorreport", report)
console.log("Successfully reported the error to the website staff.")
} catch(err) {
console.warn("Failed reporting the error to the website staff:", err)
}
}
}