Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kamkam1_0/errorhandler

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kamkam1_0/errorhandler

ErrorHandler is simple to use module that allows you to handle several errors to prevent your program from crashing

  • 1.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
0
Weekly downloads
 
Created
Source

ErrorHandler

ErrorHandler is simple to use module that allows you to handle several errors to prevent your program from crashing

Installation

npm install @kamkam1_0/errorhandler

Functionalities

Here are the error types supported by ErrorHandler

rejectionHandled
uncaughtException
uncaughtExceptionMonitor
unhandledRejection
  • ErrorHandler stops the process when 5 errors happen in less than 5 seconds
  • ErrorHandler stops the process when the number of stored errors is egual to 100
  • ErrorHandler create a file for each error (with the error in it) and store it in the directory of the process

How to use

General Use

const ErrorHandler = require("@kamkam1_0/errorhandler")
ErrorHandler.deploy()

Specific use

You can also select one or more specific error types to deploy them

const ErrorHandler = require("@kamkam1_0/errorhandler")
process.on("rejectionHandled", err => ErrorHandler.rejectionHandled(err))

Sending the error

One of the feature is also the capacity to send the error. You can do that by creating a function to do that.

let sendingFunction = function(err){
    //Your code to send
    //For Example with discord: 
    bot.users.get("YOUR ID").send(`An error happened: \`\`\`${err}\`\`\``)
}
const ErrorHandler = require("@kamkam1_0/errorhandler")
process.on("rejectionHandled", err => ErrorHandler.rejectionHandled(err, undefined, undefined, sendingFunction))
//OR
ErrorHandler.deploy(sendingFunction)

Other params

You can choose to create a file for every error or not (default is true). You can also choose to log or not the error (default is true)

const ErrorHandler = require("@kamkam1_0/errorhandler")
process.on("rejectionHandled", err => ErrorHandler.rejectionHandled(error, logError, createFile, callbackFunction))
//OR
ErrorHandler.deploy(callbackFunction, logError, createFile)

Keywords

FAQs

Package last updated on 29 Sep 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc