import { ExecutionContext, Injectable, Logger } from '@nestjs/common'; import { ThrottlerException, ThrottlerGuard } from '@nestjs/throttler'; @Injectable() export class CustomThrottlerGuard extends ThrottlerGuard { private readonly logger = new Logger(CustomThrottlerGuard.name); public override async canActivate( context: ExecutionContext ): Promise { try { return await super.canActivate(context); } catch (error) { if (error instanceof ThrottlerException) { throw error; } this.logger.error(error); return true; } } }