browser-exception-collector
v0.1.0
Published
An exception collector for browser
Downloads
2
Maintainers
Readme
browser-exception-collector (WIP)
An exception collector for browser
Installation
# npm
npm install browser-exception-collector
# yarn
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)
options.debug
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