browser-exception-collector (WIP)

An exception collector for browser
Installation
npm install browser-exception-collector
yarn add browser-exception-collector
Usage
import { ExceptionCollector } from 'browser-exception-collector';
const collector = new ExceptionCollector();
collector.onError(error => {
console.error('onError', error);
console.log('onError', JSON.parse(error.toJSON()));
});
collector.onUnhandledRejection(error => {
console.error('onUnhandledRejection', error);
console.log('onUnhandledRejection', JSON.parse(error.toJSON()));
});
APIs
- ExceptionCollector
new ExceptionCollector(options)
ExceptionCollector.prototype.dispose()
ExceptionCollector.prototype.on(type, handler)
ExceptionCollector.prototype.onError(handler)
ExceptionCollector.prototype.onUnhandledRejection(handler)
ExceptionCollector.prototype.onRejectionHandled(handler)
- CustomError
new CustomError(message, errorInit)
CustomError.prototype.toString()
CustomError.prototype.toJSON()
License
MIT © Qingrong Ke