-
Notifications
You must be signed in to change notification settings - Fork 391
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
handle custom errors thrown by authorization checker #233
Conversation
I have the same requirement (but in Koa) as well, I imagine it is more or less the same logic/different file?. It now only throws code 500 errors. Excited about this feature 👍 EDIT: My bad, the 500 part is by our own general error catcher. Still would be nice to be able to differentiate between 401 and 403. |
I don't know why build test failed on the newest node.js engine:
But it's not related to this feature so I will do the honors and merge this PR with 1 new line 😉 @twittwer Thanks for your contribution, really usefull feature! It's a shame that this line wasn't there earlier 😆 |
At first glance without digging, it seems this issue exists in the koa part as well. Why did we merge this without fixing there as well? We should aim consistency between the two driver. The related part is here: KoaDriver.ts#L106 |
If no one fixes this, I will do it in the evening. Anyone should feel free to create a patch for this. |
@NoNameProvided You're right! 😞 I've spend whole day digging through issues and PR and I haven't noticed that. It would be great if you would create a patch for koa and even create a test case for this feature 😉 BTW I see more and more repeated code in drivers, I think it's time to make a big refactor to keep DRY. |
I agree on that.
I will do it. |
@NoNameProvided Sorry, for not answering - Just missed the ongoing conversation 🙈 |
Patch created in #247. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Really great module 👍
One requirement in our project is to differentiate Unauthorized and Forbidden code during authorization process.
That's why I added an catch to the authorizationChecker, to be able to throw HttpErrors the same as in controllers.
I think that could be helpful for others too.
Thanks