Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anandchowdhary/scrub
๐งน Track JS errors and send them to your backend
https://github.com/anandchowdhary/scrub
error-handling error-monitoring scrum typescript
Last synced: 2 months ago
JSON representation
๐งน Track JS errors and send them to your backend
- Host: GitHub
- URL: https://github.com/anandchowdhary/scrub
- Owner: AnandChowdhary
- License: mit
- Created: 2019-05-17T12:30:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T19:30:15.000Z (7 months ago)
- Last Synced: 2024-10-04T16:44:12.414Z (3 months ago)
- Topics: error-handling, error-monitoring, scrum, typescript
- Language: TypeScript
- Homepage: https://anandchowdhary.github.io/scrub/
- Size: 1.51 MB
- Stars: 11
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐งน Scrub
[![Travis CI](https://img.shields.io/travis/AnandChowdhary/scrub.svg)](https://travis-ci.org/AnandChowdhary/scrub)
[![GitHub](https://img.shields.io/github/license/anandchowdhary/scrub.svg)](https://github.com/AnandChowdhary/scrub/blob/master/LICENSE)
![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/AnandChowdhary/scrub.svg)
[![Minzipped size](https://img.shields.io/bundlephobia/minzip/scrub-js.svg)](https://www.npmjs.com/package/scrub-js)
[![NPM version](https://img.shields.io/npm/v/scrub-js.svg)](https://www.npmjs.com/package/scrub-js)
[![Types](https://img.shields.io/npm/types/scrub-js.svg)](https://www.npmjs.com/package/scrub-js)With Scrub, you can easily track errors and send them to your backend.
## โญ Getting started
Install Scrub as a dependency:
```bash
npm install scrub-js
```Or, if you're using Yarn:
```bash
yarn add scrub-js
```Then import the library:
```js
import Scrub from "scrub-js";
```And initialize it with your settings:
```js
const scrub = new Scrub({ endpoint: "https://example.com/track" });
```You can also use a CDN:
```html
```
Now, your errors are tracked. Try it with `throw new Error("Example error");`.
This is what an error object looks like:
```js
const error = {
"unixTimestamp": 1558166641,
"title": "undefinedVariable is not defined",
"browser": {
"name": "Chrome",
"version": "74.0.3729.157",
"major": "74",
"iconUrl": "https://cdnjs.cloudflare.com/ajax/libs/browser-logos/51.0.13/chrome/chrome_128x128.png"
},
"operatingSystem": {
"name": "Mac OS",
"version": "10.14.3",
"iconUrl": "https://unpkg.com/analytics-icons/icons/windows.png"
},
"type": "ReferenceError",
"url": "https://anandchowdhary.github.io/scrub/demo.js",
"line": 9,
"column": 43,
"func": "?",
"context": `
alsoSend: {
statusCode: "new"
}
});
console.log("This should throw an error", undefinedVariable);
`
};
```## ๐ License
MIT