Skip to content

nanogiants/nestjs-swagger-api-exception-decorator

This branch is up to date with develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d285629 · Jan 31, 2025
Aug 7, 2023
Aug 7, 2023
Jul 29, 2021
Aug 7, 2023
Aug 7, 2023
Jul 29, 2021
Dec 7, 2020
Jun 15, 2021
Mar 12, 2021
Jul 9, 2021
Feb 24, 2021
Jan 29, 2025
Jan 29, 2025
Feb 24, 2021
Jul 29, 2021
Jul 29, 2021

Repository files navigation

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.