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

1.0.4 • Public • Published

Exceptions 🛑

Very simple Exceptions for NodeJS Applications and other SecJS packages

GitHub followers GitHub stars

Buy Me A Coffee

GitHub language count Repository size License Commitizen

The intention behind this repository is to always maintain a viable and simple exception creator to use in any type of NodeJS Framework and inside all SecJS packages.

Installation

npm install @secjs/exceptions

Usage

BaseException

Create your own custom exception extending BaseException methods

class MyCustomException extends BaseException {
  constructor(content: string | object = 'My default error', status = 400) {
    super(MyCustomException.name, content, status);
  }
}

throw new MyCustomException({ error: 'object', use: 'as you want!' })

SecJS Exceptions

Or if you prefer, you can use the already built in exception from this package

import { 
  BadRequestException, 
  ForbiddenException, 
  InternalServerException, 
  InvalidMethodException, 
  NotFoundException,
  NotImplementedException,
  UnauthorizedException,
  UnprocessableEntityException,
  UnsupportedMediaException,
} from '@secjs/exceptions'

License

Made with 🖤 by jlenon7 👋

/@secjs/exceptions/

    Package Sidebar

    Install

    npm i @secjs/exceptions

    Weekly Downloads

    1

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    15.5 kB

    Total Files

    25

    Last publish

    Collaborators

    • jlenon7