# jerrbit

> Report client-side, browser events and exceptions to an Errbit or Airbrake service

Latest version **1.0.1** (published 2018-09-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install jerrbit
pnpm add jerrbit
yarn add jerrbit
bun add jerrbit
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-09-30 |
| First published | 2016-01-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 130.3 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Aleck Greenham |
| Maintainers | greena13 |
| Keywords | Errbit, Airbrake, exception, reporting, monitoring, browser, client-side |

## Links

- npm: https://www.npmjs.com/package/jerrbit
- Repository: https://github.com/greena13/jerrbit
- Homepage: https://github.com/greena13/jerrbit#readme
- Issues: https://github.com/greena13/jerrbit/issues
- npm.io page: https://npm.io/package/jerrbit

## Dependencies (6)

- [merge](https://npm.io/package/merge.md) ^1.2.0
- [cookie](https://npm.io/package/cookie.md) ^0.3.1
- [platform](https://npm.io/package/platform.md) ^1.3.1
- [stack-trace](https://npm.io/package/stack-trace.md) 0.0.10
- [query-string](https://npm.io/package/query-string.md) 5
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) ^3.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-09-30
- 1.0.0 — 2018-09-30
- 0.1.0 — 2018-02-13
- 0.0.4 — 2016-06-11
- 0.0.3 — 2016-06-11
- 0.0.2 — 2016-01-18
- 0.0.1 — 2016-01-18

## README

# Jerrbit

[![npm](https://img.shields.io/npm/dm/jerrbit.svg)]()
[![GitHub license](https://img.shields.io/github/license/greena13/jerrbit.svg)](https://github.com/greena13/jerrbit/blob/master/LICENSE)

Report client-side, browser events and exceptions to an Errbit or Airbrake service

## Usage

```javascript
var Client = require('jerrbit').Client;

var errbitClient = new Client({
  host: 'http://errbit.your-service.com',
  projectKey: 'ProjectAPIKey',
  context: {
    environment: 'production'
  }
});

try {
  // Your application code here

} catch(error){
  errbitClient.notify(error, {
    context: {
      version: '1.1.1'
    }
  });

  throw(error);
}
```

## Options

`Jerrbit.Client` requires the following options to configure which Errbit server to use.

- `host`: The URL of the Errbit server
- `projectKey`: The API key for the project you wish log the errors against


### Airbrake Options

Jerrbit supports all of the [Airbrake V3 API properties](https://airbrake.io/docs/#create-notice-v3) and sets a lot of them for you, but all values can be overwritten if you need.

Field | Required | Supplied by Errbit | Default value is set in | Description
----- | -------- | ------------------ | ----------- | ----------
`errors` | Yes | Yes | `notify` | An array of objects describing the error that occurred.
`errors/{i}/type` | Yes| Yes | `notify` |  The class name or type of error that occurred.
`errors/{i}/message` | No | Yes | `notify` | A short message describing the error that occurred.
`errors/{i}/backtrace` | Yes | Yes | `notify` | An array of objects describing each line of the error’s backtrace.
`errors/{i}/backtrace/{i}/file` | Yes | Yes | `notify` | The full path of the file in this entry of the backtrace.
`errors/{i}/backtrace/{i}/line` | No | Yes | `notify` | The file’s line number in this entry of the backtrace.
`errors/{i}/backtrace/{i}/column` | No | Yes | `notify` | The line’s column number in this entry of the backtrace.
`errors/{i}/backtrace/{i}/function` | No | Yes | `notify` | When available, the function or method name in this entry of the backtrace.
`context` | No | No | NA | An object describing additional context for this error.
`context/notifier`| Yes | Yes | N/A | An object describing the notifier client library.
`context/notifier/name` | Yes | Yes | `new` | The name of the notifier client submitting the request, e.g. “airbrake-js”.
`context/notifier/version` | Yes| Yes | `new` | The version number of the notifier client submitting the request, e.g. “1.2.3”.
`context/notifier/url` | Yes | Yes | `new` | A URL at which more information can be obtained concerning the notifier client.
`context/environment` | No | 'development' | `new` |  The name of the server environment in which the error occurred, e.g. “staging”, “production”, etc.
`context/component` | No | No | N/A | The component or module in which the error occurred. In MVC frameworks like Rails, this should be set to the controller. Otherwise, this can be set to a route or other request category.
`context/action` | No | No | N/A | The action in which the error occurred. If each request is routed to a controller action, this should be set here. Otherwise, this can be set to a method or other request subcategory.
`context/os` | No | Yes | `new` | Details of the operating system on which the error occurred.
`context/language` | No | 'JavaScript' | `new` | Describe the language on which the error occurred, e.g. “Ruby 2.1.1”.
`context/version` | No | No |  | Describe the application version, e.g. “v1.2.3”.
`context/url` | No | Yes | `notify` | The application’s URL.
`context/userAgent` | No | Yes | `new` | The requesting browser’s full user-agent string.
`context/rootDirectory` | No | No | N/A | The application’s root directory path.
`context/user/id` | No | No | N/A | If applicable, the current user’s ID.
`context/user/name` | No | No | N/A | If applicable, the current user’s username.
`context/user/email` | No | No | N/A | If applicable, the current user’s email address.
`environment` | No | No | N/A | An object containing the current environment variables. Where the key is the variable name, e.g. { "PORT": "443", "CODE_NAME": "gorilla" }.
`session` | No | Yes | `notify` | An object containing the current session variables. Where the key is the variable name, e.g. { "basket_total": "1234", "user_id": "123" }.
`params` | No | Yes | `notify` | An object containing the request parameters. Where the key is the parameter name, e.g. { "page": "3", "sort": "desc" }.

### Overwriting the default context values

You can overwrite the default values by either specifying them when instantiating `Client` or when calling `notify`. Values that are not expected to change over the course of your application should be specified when instantiating `Client`.

```javascript
var errbitClient = new Client({
  host: 'http://errbit.your-service.com',
  projectKey: 'ProjectAPIKey',
  context: {
    environment: 'production',
    language: 'JavaScript & XML'
  }
});
```

Those values that can change should be set using `notify`. These values must be specified each time `notify` is called or they may be overwritten with the default values.

```javascript
errbitClient.notify(error, {
  context: {
    user: window.user
  }
});
```

---
_Source: https://npm.io/package/jerrbit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
