17 lines
460 B
JavaScript
17 lines
460 B
JavaScript
|
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,
|
||
|
}),
|
||
|
});
|
||
|
});
|