New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

catch-global-error

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

catch-global-error

catch javascript global error

latest
Source
npmnpm
Version
1.3.1
Version published
Maintainers
1
Created
Source

catch-global-error ( web )

devtools(vConsole)、upload error、monitoring logs

Use

npm install catch-global-error --save
// or
yarn add catch-global-error
import CatchError from 'catch-global-error';

const catchError = new CatchError();
catchError.init({
  url: '/api/error/log', // upload error site
});
const a = 1;
console.log(a.b.c);

Method

init([config])

initialize

options parameter

paramdescriptiontypevaluedefault value
urlthe site of uploading errorString--
methodthe method of uploading errorStringget/postpost
showDevtoolsshow devtoolsBooleantrue/falsefalse
urlSwitchurl query for devtoolsObject-{ devtools: 'show' }
cdnvConsole cdnString-'https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js'
extendFieldsadd extend field about business or project what you want to send to the service, such as business_line, typeObject--

show()

show devtools

Demo of devtools

1. showDevtools = true

// 1: init
import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init({
  showDevtools: true, // default show Devtools
});

2. url query

// default: www.***.com?devtools=show
// you can change url query switch

// eq: www.***.com?show=test
import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init({
  urlSwitch: {
    show: 'test',
  },
});

3. catchError.show

import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init();

window.onclick = () => {
  catchError.show();
};

LICENSE

MIT

Keywords

catch

FAQs

Package last updated on 21 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts