Skip to content

SecJS/Exceptions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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 ๐Ÿ‘‹