@cubiles/nestjs-app-exception
v11.1.0
Published
``` $ npm i @cubiles/nestjs-app-exception ```
Readme
Installation
$ npm i @cubiles/nestjs-app-exceptionExample
Usage as nestjs filter
app.useGlobalFilters(new AppExceptionFilter());Define AppException
Create an AppException
const exception = AppExceptionBuilder.create()
.setScope('Database')
.setCode('P2302')
.setMessage('ErrorMessage')
.build();Create an AppException and throw it
const exception = AppExceptionBuilder.create()
.setScope('Database')
.setCode('P2302')
.setMessage('ErrorMessage')
.throw();Create an AppException with a another cause
const anotherExpception = AppExceptionBuilder.create()
.setScope('Account')
.setCode('P2302')
.setCause(exception)
.throw();