15

Show EJ: Unhandler - creates bug reports for uncaught exceptions and unhandled r...

 4 years ago
source link: https://github.com/tuplo/unhandler
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

unhandler

Creates bug reports for uncaught exceptions and unhandled rejections. Works like a DYI Sentry client. Can publish bug reports on different trackers simultaneously.

Install

$ npm install @tuplo/unhandler

# or with yarn
$ yarn add @tuplo/unhandler

Usage

import { unhandler } from '@tuplo/unhandler';

Registers event handlers for uncaughtException and unhandledRejection

unhandler({
  appName: 'my-app-1',
  providers: {
    github: {
      user: 'tuplo',
      repo: 'unhandler',
      token: 'secret-token-xxxxxxx',
    },
  },
});

throw new Error('buggy bug');

// will create a GitHub issue with title "[my-app-1] buggy bug"

Creates bug reports directly with submitError

import { submitError } from '@tuplo/unhandler';

const error = new Error('buggy bug');

await submitError(error, {
  appName: 'my-app-1',
  providers: {
    github: {
      user: 'tuplo',
      repo: 'unhandler',
      token: 'secret-token-xxxxxxx',
    },
  },
});

// will create a GitHub issue with title "[my-app-1] buggy bug"

Error tracking providers

  • GitHub Issues
  • Trello
  • JIRA

API

unhandler(options)

options

appName: string

The name of the application triggering the error.

providers: Provider[]

GitHub

name type description user string The user or organization, owner of the repository where issues will be created. repo string The name of the repository where issues will be created. token string GitHub's personal access token with a repo scope.

Contribute

Contributions are always welcome!

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK