Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
rpcExceptionHandler.ts 378 B
import type { RpcExceptionFilter } from '@nestjs/common';
import type { RpcException } from '@nestjs/microservices';

import { Catch } from '@nestjs/common';
import { throwError } from 'rxjs';

@Catch()
export class ExceptionHandler implements RpcExceptionFilter<RpcException> {
  public catch(exception: RpcException) {
    return throwError(() => exception.getError());
  }
}