I have a sample application created in NestJs which does not have a single controller. I have created global exception filter and injected it via app module like:
providers: [
{
provide: APP_FILTER,
useClass: CustomExceptionFilter,
},
]
When any service method called and exception occurs, call is not coming in my custom exception filter. Note that I have not a single controller in my application. There are modules and services only.
Also I have tried registering my custom filter in main.ts which is not working:
app.useGlobalFilters(new CustomExceptionFilter());
I want to handle exceptions of all type using global exception filter only. Any help is appreciated.