Socket
Book a DemoInstallSign in
Socket

ohcrash-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ohcrash-client

Node.js client for reporting errors to OhCrash server

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source


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: 'john@doe.com'
});

License

MIT © Vadim Demedes

FAQs

Package last updated on 05 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts