SkillAgentSearch skills...

Scrub

๐Ÿงน Track JS errors and send them to your backend

Install / Use

/learn @AnandChowdhary/Scrub
About this skill

Quality Score

0/100

Category

Operations

Supported Platforms

Universal

README

๐Ÿงน Scrub

Travis CI GitHub Vulnerabilities Minzipped size NPM version Types

With Scrub, you can easily track errors and send them to your backend.

โญ Getting started

Install Scrub as a dependency:

npm install scrub-js

Or, if you're using Yarn:

yarn add scrub-js

Then import the library:

import Scrub from "scrub-js";

And initialize it with your settings:

const scrub = new Scrub({ endpoint: "https://example.com/track" });

You can also use a CDN:

<script src="https://unpkg.com/scrub-js"></script>

Now, your errors are tracked. Try it with throw new Error("Example error");.

This is what an error object looks like:

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

View on GitHub
GitHub Stars11
CategoryOperations
Updated2y ago
Forks6

Languages

TypeScript

Security Score

80/100

Audited on Nov 15, 2023

No findings