https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
NestJS Swagger decorator for API exceptions
https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
Last synced: 2 months ago
JSON representation
NestJS Swagger decorator for API exceptions
- Host: GitHub
- URL: https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
- Owner: nanogiants
- License: mit
- Created: 2020-04-20T08:20:21.000Z (about 5 years ago)
- Default Branch: develop
- Last Pushed: 2025-03-07T13:26:43.000Z (3 months ago)
- Last Synced: 2025-03-29T00:08:26.517Z (2 months ago)
- Language: TypeScript
- Size: 3.93 MB
- Stars: 42
- Watchers: 5
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS Swagger API Exception Decorator
[](https://github.com/nanogiants/nestjs-swagger-api-exception-decorator/workflows/Node.js%20CI)
[](https://sonarcloud.io/dashboard?id=nanogiants_nestjs-swagger-api-exception-decorator)
[](https://sonarcloud.io/dashboard?id=nanogiants_nestjs-swagger-api-exception-decorator)
[](https://www.npmjs.com/package/@nanogiants/nestjs-swagger-api-exception-decorator)
[](https://www.npmjs.com/package/@nanogiants/nestjs-swagger-api-exception-decorator)## Description
[NestJS Swagger](https://docs.nestjs.com/openapi/introduction) decorator for API exceptions.
## Installation
```sh
$ npm i @nanogiants/nestjs-swagger-api-exception-decorator
```## Example
```typescript
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 {
return res.sendStatus(HttpStatus.OK);
}
}
```## Getting Started
Please visit our [documentation](https://nanogiants.github.io/nestjs-swagger-api-exception-decorator/) to get started.
## Release Notes
Please visit the [Release Notes](https://nanogiants.github.io/nestjs-swagger-api-exception-decorator/releasenotes/v1.5.0) in our documentation for major and minor releases. Patch releases are documentated in [GitHub Releases](https://github.com/nanogiants/nestjs-swagger-api-exception-decorator/releases).