1.0.3 • Published 2 years ago

@bryandollery/errors-and-signals v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

A simple handler for otherwise unhandled exceptions and signals in node

Usage

Install

npm i @bryandollery/errors-and-signals

Import

import { errors-and-signals } from "@bryandollery/errors-and-signals";

Configure

const ctx = "myappname";

errorsAndSignals(async () => {
  await producer.disconnect();
}, ctx);

The first parameter is a handler for freeing resources, the second optional paramemter is a context used for logging. Output logs are json strings mostly at the INFO or ERROR levels.

Notes

The errors and signals handled by this library are defined by:

const errorTypes = ["unhandledRejection", "uncaughtException"];
const signalTraps = ["SIGTERM", "SIGINT", "SIGUSR2"];
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago