-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add option to OrGuard to throw the last or custom error #44
feat: add option to OrGuard to throw the last or custom error #44
Conversation
🦋 Changeset detectedLatest commit: 458f98f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2b41c5e
to
887c6ce
Compare
What's the use case for throwing the last encountered error? The first is for a fast fail. What about any errors between the first and last, should they be merged and thrown for better reporting? |
I have this case @UseGuards(OrGuard([GuardForUser, GuardForApiKey])) Both guards when used separately throw 401, but if they fail with @UseGuards(OrGuard([GuardForUser, GuardForApiKey], { throwError: new UnauthorizedException('No authorization provided') })) Let me propose this override as well 02b7d08 |
b0ae573
to
c694b39
Compare
I'm interested in this feature for the same reason (being able to return 401 status code when multiple auth strategies fail rather than 403). @jmcdo29 Any chance this could be merged? 🙏 |
Thanks for the ping on this @ls-mmacdonald. This does look like something that's well thought out and could be easily supported. I'll try to make a changeset for this here soon so that it can be merged and published, unless @p-dim-popov wants to get that done, but as it's been a bit I wouldn't expect any quick response. |
c77fcd5
to
458f98f
Compare
Tests pass locally. Merging to main |
No description provided.