@nanogiants/nestjs-swagger-api-exception-decorator
TypeScript icon, indicating that this package has built-in type declarations

1.6.11 • Public • Published

NestJS Swagger API Exception Decorator

Node.js CI Quality Gate Status Coverage npm npm downloads

Description

NestJS Swagger decorator for API exceptions.

Installation

$ npm i @nanogiants/nestjs-swagger-api-exception-decorator

Example

import { ApiException } from '@nanogiants/nestjs-swagger-api-exception-decorator';

@ApiException(() => UnauthorizedException)
export class Controller {
  @ApiOperation({ summary: 'Changes the users password' })
  @ApiException(() => [PasswordsDidNotMatchException, OldAndNewPasswordMatchException, CredentialsNotValidException])
  @Patch('/password')
  async changeUserPassword(@Res() res: Response): Promise<void> {
    return res.sendStatus(HttpStatus.OK);
  }
}

Getting Started

Please visit our documentation to get started.

Release Notes

Please visit the Release Notes in our documentation for major and minor releases. Patch releases are documentated in GitHub Releases.

Dependencies (0)

    Dev Dependencies (22)

    Package Sidebar

    Install

    npm i @nanogiants/nestjs-swagger-api-exception-decorator

    Weekly Downloads

    16,116

    Version

    1.6.11

    License

    MIT

    Unpacked Size

    45.1 kB

    Total Files

    48

    Last publish

    Collaborators

    • nanogiantsadmin
    • dasheck0
    • blackfaded