Wrapper around Stacktrace.js to easyly add it to zliq. It will remove calls inside zliq from the stacktrace, making it easier to read.
To use ZLIQ-stacktrace in your project, first install it as an dependency:
$ npm install --save zliq-stacktrace
IMPORTANT: Activate sourcemaps in your development environment.
Then activate the stacktrace shrinking.
import {shrinkStacktrace} from 'zliq-stacktrace';
// shrinkStacktrace returns an errorhandler
// how your environment returns the files is very different, just create a regex to filter node_modules or similar
const errorHandler = shrinkStacktrace(
/node_modules\/zliq/, // blackList (optional)
/.*/ // whitelist (optional)
);
// use it globaly
window.onerror = (messageOrEvent, source, lineno, colno, error) => {
return errorHandler(error);
};
// or use it locally
try {
// CODE BLOCK
} catch (error) {
errorHandler(error)
}