Skip to content

Instantly share code, notes, and snippets.

View leo-at-itartpro's full-sized avatar
🤓
Working hard, and playing catch-up

Leo leo-at-itartpro

🤓
Working hard, and playing catch-up
View GitHub Profile
@Shoora
Shoora / catch-js-error-stacktrace.js
Created April 13, 2020 17:26 — forked from eyecatchup/catch-js-error-stacktrace.js
JavaScript global error handling
var sendError = function (err) {
console.log('Caught JS client error:');
console.dir(err);
var xhr = new XMLHttpRequest();
xhr.open('POST', '/api/error/add', true);
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
xhr.send(JSON.stringify(err));
};