I am executing command
ng g interceptor error
where error is the name of interceptor
but facing the issue as below:
An unhandled exception occurred: Schematic "interceptor" not found in collection "@schematics/angular".
Do we have to install any package first ?
Looks like schematic support for generating interceptors was added in CLI 9.0.0
So, you can either upgrade to Angular 9, or write your own custom schematic, though in the short-term, if you can't / don't want to upgrade to Angular 9, it's probably easier to just write your interceptor yourself instead of generating it.