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

1.4.1 • Public • Published

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

Node.js CI Quality Gate Status Coverage npm npm downloads

NestJS Swagger decorator for API exceptions

Installation

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

Example usage

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);
  }
}

Documentation

Please visit our documentation for examples and information on how to use this decorator.

Package Sidebar

Install

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

Weekly Downloads

1

Version

1.4.1

License

MIT

Unpacked Size

310 kB

Total Files

48

Last publish

Collaborators

  • r.gazeri