fe-error-tracker
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Front End Error Tracker

A simple plugin to enable the window.onerror function to send details of runtime errors to a backend service.

Intercepted errors can be logged with another service.

Usage

npm i --save fe-error-tracker

--

// main.ts / main.js

import { feErrorTracker } from 'fe-error-tracker';

aFunctionThatIsCalledWhenYourAppInits = () => {
    const APP_NAME = 'example-app';                 // Unique identifier of the application
    const LOGGING_URL = 'http://mylogger.com';      // Url for sending logs to
    const DEBUG = false;                            // If set to true, will log requests before sending them

    feErrorTracker.init('Unique application name', 'Url to report errors to', true);
}

Tracking Items / Example Payload

{  
    "error": " Error to push, from window.onerror or manual error ",
    "currentUrl":" The Page URL of the client when the error occured ",
    "lineNumber": "Line number that the error was on ",
    "viewportHeight": "",
    "viewportWidth": "",
    "clientInfo":{  
        "language":"en-GB",
        "platform":"Linux x86_64",
        "userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36",
        "cookieEnabled": "true"
    }
}

Contribution

Build

This plugin is written in TypeScript, please make desired changes to files in the src folder and run npm build to compile the changes

Test

Tests are written with jest, use npm t to test.

Readme

Keywords

none

Package Sidebar

Install

npm i fe-error-tracker

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

19.8 kB

Total Files

19

Last publish

Collaborators

  • mattrhysgregory