1.3.2 • Published 2 months ago

@kamkam1_0/errorhandler v1.3.2

Weekly downloads
-
License
MPL 2.0
Repository
github
Last release
2 months ago

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(sendingFunction, err))
//OR
ErrorHandler.deploy(sendingFunction)
1.3.2

2 months ago

1.3.1

3 months ago

1.3.0

4 months ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.0.0

1 year ago