JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30526F
  • License MIT

Error handling utilities for Express.js

Package Exports

  • @error-handler/express
  • @error-handler/express/lib/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@error-handler/express) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Error handling utilities for Express.js

This package provides a set of utilities to handle errors in an Express.js application. It includes middleware for handling errors, a custom error class, and a utility function to create errors.

Installation

npm install @error-handler/express

Usage

Custom Error Class

const { CustomError } = require('@error-handler/express');

try {
    throw new CustomError('This is a custom error', 400);
} catch (error) {
    console.error(error.message); // This is a custom error
    console.error(error.status); // 400
}