创建错误处理拦截器errors interceptor,之前好像有个过滤器filters?

This commit is contained in:
Jeremy Yin 2019-06-20 21:48:28 +08:00
parent d56b4f21db
commit 3e83be0032
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import { ErrorsInterceptor } from './errors.interceptor';
describe('ErrorsInterceptor', () => {
it('should be defined', () => {
expect(new ErrorsInterceptor()).toBeDefined();
});
});

View File

@ -0,0 +1,9 @@
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
@Injectable()
export class ErrorsInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
return next.handle();
}
}