# errtracker-lib

> A small lib to catch error and handle it.

Latest version **0.1.8** (published 2020-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install errtracker-lib
pnpm add errtracker-lib
yarn add errtracker-lib
bun add errtracker-lib
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2020-02-09 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 114.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vitalie Andries |
| Maintainers | vandriesh |
| Keywords | javascripts, error, track, notify |

## Links

- npm: https://www.npmjs.com/package/errtracker-lib
- Repository: https://github.com/vandriesh/errtracker-lib
- Homepage: https://github.com/vandriesh/errtracker-lib#readme
- Issues: https://github.com/vandriesh/errtracker-lib/issues
- npm.io page: https://npm.io/package/errtracker-lib

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.1.8 (latest) — 2020-02-09
- 0.1.7 — 2020-02-08
- 0.1.6 — 2020-02-08
- 0.2.0 — 2020-02-08
- 0.1.5 — 2019-04-25
- 0.1.2-m — 2019-04-24
- 0.1.2 — 2019-04-24
- 0.1.0 — 2019-04-19
- 0.0.4 — 2019-04-18
- 0.0.0-development — 2019-04-18
- 0.0.3 — 2019-04-17
- 0.0.2 — 2019-04-17
- 0.0.1 — 2018-12-21

## README

# ErrTracker Library

[![Build Status](https://travis-ci.com/vandriesh/errtracker-lib.svg?branch=master)](https://travis-ci.com/vandriesh/errtracker-lib)
[![Coverage Status](https://coveralls.io/repos/github/vandriesh/errtracker-lib/badge.svg?branch=master)](https://coveralls.io/github/vandriesh/errtracker-lib?branch=master)

## Usage scenarios

1. Report to slack every error. Might create some slack distractions.
2. Report `first of its kind` error only. Per device. 
    Since the info about errors are kept in device's localstorage (if supported).
3. Report every error and store it in AWS. Working on it.    

## Config

### Slack details

| Parameter name   | type (default value)   | mandatory | description       |
|------------------|--------|-----------|-----------------------------------|
| webHookUrl       | string | true      | slack webhook generated by slack  |
| useConsoleLogger | boolean (false) | false     | false     | details you might need to provide |
| details          | object | false     | details you might need to provide |


### AWS example

| Parameter name   | type   | mandatory | description                       |
|------------------|--------|-----------|-----------------------------------|
| apiKey           | string | true      | header api key - granting access to api (generated on request, for now) |
| token            | string | true      | id to store error                 |
| useConsoleLogger | boolean| false     | report about server side response, can provide custom logger |
| url              | string | false     | where error was thrown            |
| details          | object | false     | details you might need to provide |

## Config samples

### Slack every error report
```html
  <script src="/path/to/errtracker-slack-lib.es5.js"></script>
  <script>
    (function(et, d, n) {
      if (!et) {
        return
      }

      et({
        webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
        details: {
          platform: n.platform,
          userAgent: n.userAgent,
          url: d.location
        }
      });
    })(window['slackErrTracker'], window.document, window.navigator);
  </script>
```

### Slack unique error report only example
```html
<script src="/path/to/errtracker-unique-slack-lib.es5.js"></script>
<script>
  (function(et, d, n) {
    if (!et) {
      return
    }

    et({
      webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
      details: {
        platform: n.platform,
        userAgent: n.userAgent,
        url: d.location
      }
    });
  })(window['uniqueSlackErrTracker'], window.document, window.navigator);
</script>
```


### AWS example

```html
<script src="/path/to/errtracker-lib.es5.js"></script>
<script>
(function(et, d, n) {
  if (!et) {
    return
  }
  et({
    // mandatory
    apiKey: 'xxxx-xxxx-xxxx',
    token: 'xxxxxx-xxxx-xx-xxx-xxxxxxxxx',
    // below are optional
    useConsoleLogger: true,
    url: d.location,
    details: {
      platform: n.platform,
      userAgent: n.userAgent
    }
  });
})(window['errtracker'], window.document, window.navigator);
</script>
```

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