Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

[FEATURE REQUEST] Allow to throw custom error instances #94

Open
elderapo opened this issue May 3, 2022 · 0 comments
Open

[FEATURE REQUEST] Allow to throw custom error instances #94

elderapo opened this issue May 3, 2022 · 0 comments

Comments

@elderapo
Copy link

elderapo commented May 3, 2022

Similar to custom error message but allow to throw a whole custom error. Something like:

import { RateLimit } from 'nestjs-rate-limiter'

@RateLimit({ onRateLimit: () => { new MyCustomError(); } })
@Get('/signup')
public async signUp() {
    console.log('hello')
}

Not sure about the exact API. It could be createError: () => Error, throwError: () => never. Also maybe we could provide statistics to the handler so custom error instance could be passed in info why the rate limit was reached.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant