Skip to main content

Templated decorator

When using the templated decorator you can specify your own template to match the response body of your NestJS exception filters:

@Controller()
@ApiException(() => UnauthorizedException, { description: 'User is not authorized' })
export class AppController {
@Post()
@ApiOperation({ summary: 'This is an example with custom named exceptions' })
@TemplatedApiException(() => [MissingPropertyException, PayloadMissingException])
createResource() {
return 'resource has been created';
}
}

Templated decorator screenshot example