@skybackend/nestjs-swagger-api-exception-decorator
v1.4.1
Published
NestJS Swagger decorator for API exceptions
Downloads
2
Readme
@nanogiants/nestjs-swagger-api-exception-decorator
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.