browser-exception-collector
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

browser-exception-collector (WIP)

npm version

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

/browser-exception-collector/

    Package Sidebar

    Install

    npm i browser-exception-collector

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    68.6 kB

    Total Files

    16

    Last publish

    Collaborators

    • dearke