import { Observable , throwError } from 'rxjs' ; import { Catch , ExceptionFilter } from '@nestjs/common' ; import { RpcException } from '@nestjs/microservices' ; import { ExceptionsService } from '../exceptions.service' ; import { FcBaseExceptionFilter } from './fc-base.exception-filter' ; see https @ Catch ( RpcException ) export class RpcExceptionFilter extends FcBaseExceptionFilter implements ExceptionFilter { catch ( exception ) { this . logger . debug ( 'Exception from RpcException' ) ; const code = ExceptionsService . getExceptionCodeFor ( exception ) ; const id = ExceptionsService . generateErrorId ( ) ; this . logException ( code , id , exception ) ; return throwError ( exception . getError ( ) ) ; } }