NestJS - Interceptors
What is wrong with this interceptor implementation?
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
import { Observable } from 'rxjs';
@Injectable()
export class ErrorInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable {
try {
return next.handle();
} catch (error) {
console.error('Error caught:', error);
throw error;
}
}
} 