Git Product home page Git Product logo

ohcrash-client's Introduction


OhCrash


Build Status

Error reporting client for OhCrash microservice. OhCrash is a tiny microservice, that creates issues on GitHub for all reported errors. Learn more at OhCrash repository.

Installation

$ npm install ohcrash-client --save

Usage

Set up an OhCrash microservice and deploy it. There's no hosted version, so a URL to your own server is required.

require('ohcrash-client').register('https://my-ohcrash.now.sh');

That's it, from now on uncaught exceptions and unhandled rejections will be reported to the server. Client's behavior can be customized via options.

Configuration

Client accepts an options object as a second argument, which can customize some of its behavior.

require('ohcrash-client').register('https://my-ohcrash.now.sh', {
	// auto catch uncaught exceptions (default: `true`)
	exceptions: true,

	// exit after uncaught exception is reported (default: `true`)
	exit: true,

	// auto catch unhandled rejections (default: `true`)
	rejections: true,

	// properties that all errors inherit (default: `{}`)
	// useful for sending values like app environment and version
	globalProps: {
		env: process.env.NODE_ENV,
		version: '1.0.0'
	}
});

Custom reporting

It is also possible to report errors manually by using report().

const ohcrash = require('ohcrash-client').register('https://my-ohcrash.now.sh');

const err = new Error('I know this error');
await ohcrash.report(err);
// error reported

Errors can also have GitHub issue labels assigned to them:

ohcrash.report(err, {
	labels: ['priority', 'bug', 'help wanted']
});

Any additional properties can be assigned as well, they will be included in the GitHub issue. For example, error could have user's email assigned to it:

ohcrash.report(err, {
	user: '[email protected]'
});

License

MIT ยฉ Vadim Demedes

ohcrash-client's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.