Quick and dirty extract of the official script to be used as NPM module without polluting global space. There are no additional dependencies.
npm install errorception
import errorception from 'errorception';
errorception.setup(-ProjectID-);
These two lines should be included in your code as soon as possible. Calling setup will actually attach window.onerror
to report unhandled exceptions.
Official documentation: https://errorception.com/docs/push
errorception.push(error);
Official documentation: https://errorception.com/docs/meta
const meta = {
email: "email@domain.com",
sessionId: 4138727492,
lovesCats: true
};
errorception.setup(-ProjectID-, meta);
// OR
errorception.setMeta(meta);
// OR
errorception.push(error, meta);
Note that every type of call overwrites global meta for a whole module. Currently there is no way to specify meta for a single error report.
Official documentation: https://errorception.com/docs/allow
errorception.useFilter(function() {
return (navigator.userAgent.indexOf("MSIE 6") == -1);
});
Once again this is global per whole module.