import { ArgumentsHost , Catch , ExceptionFilter } from '@nestjs/common' ; import { IntelError } from '../types' ; import { IntelServiceException } from './intel-exception' ; @ Catch ( IntelServiceException ) export class IntelServiceExceptionFilter implements ExceptionFilter { catch ( exception , host ) { const client = host . switchToWs ( ) . getClient ( ) ; const errorRespsonse = { name : exception . name , message : exception . message , } ; client . emit ( 'exception' , errorRespsonse ) ; } }