Report errors to server
This commit is contained in:
16
web/static/js/reporter.js
Normal file
16
web/static/js/reporter.js
Normal file
@ -0,0 +1,16 @@
|
||||
const REPORTER_ID = crypto.randomUUID();
|
||||
|
||||
window.addEventListener("error", async (ev) => {
|
||||
await fetch("/report", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
reporterId: REPORTER_ID,
|
||||
url: window.location.href,
|
||||
relativeTimestamp: ev.timeStamp,
|
||||
errorMessage: ev.message,
|
||||
errorLine: ev.lineno,
|
||||
errorFile: ev.filename,
|
||||
errorType: ev.type,
|
||||
}),
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user