1.0.4 • Published 5 years ago

fe-error-tracker v1.0.4

Weekly downloads
2
License
ISC
Repository
gitlab
Last release
5 years ago

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.

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago