@availity/exceptions-axios
TypeScript icon, indicating that this package has built-in type declarations

4.0.5 • Public • Published

@availity/exceptions-axios

A package wrapping the Exceptions class to use axios. Using avLogMessagesApi to log errors.

Version NPM Downloads Dependecy Status

More details about configuration can be found in Exceptions-Core

Install

NPM

npm install @availity/exceptions-axios

Yarn

yarn add @availity/exceptions-axios

Usage

Add module to your app.

import avExceptionsAxios from '@availity/exceptions-axios';

Configure the default options

import avExceptionsAxios from '@availity/exceptions-axios';

avExceptionsAxios.enabled(false); // enabled defaults to true... this example would disable it
avExceptionsAxios.appId('exampleApp'); // if undefined, logs 'N/A'
avExceptionsAxios.repeatTime(5000); // sets the time in ms between logging calls for the same error message. (default 5 seconds)

It will automatically catch all error which bubble up to the window (error which are not caught and handled in code) and log those errors. So as long as you are not catching your error you should be able to throw and error to log it.

// this import doesn't need to be on every file, just needs to be imported once somewhere like the main index.js or App.js
import avExceptionsAxios from '@availity/exceptions-axios';

// ... somewhere when something happened
throw new Error('As long as this error is not caught it will be logged');

Or you can manually log and error in the case where something is catching and handling errors before they bubble to the window:

import avExceptionsAxios from '@availity/exceptions-axios';

// ... somewhere when something happened
avExceptionsAxios.submitError(new Error('Manually logging this error'));

Readme

Keywords

none

Package Sidebar

Install

npm i @availity/exceptions-axios

Weekly Downloads

1

Version

4.0.5

License

MIT

Unpacked Size

25.2 kB

Total Files

13

Last publish

Collaborators

  • lauroxx
  • dznjudo
  • availity-cicd-bot
  • azeigler
  • dnoler
  • jselden
  • cbaker1
  • twarner
  • gregmartdotin
  • hnicbaker
  • chrishavekost
  • jordan-a-young