-
Notifications
You must be signed in to change notification settings - Fork 32
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
Errors are swallowed inside easyRBAC #13
Comments
First off thank you for the feedback. I thought I already addressed this, but I guess it was in my dreams. I agree with the idea that an error should be thrown out of the rbac check if the underlying conditional functions throw an error - otherwise it is confusing. In that regard I agree with your assessment about the lines involved in this process. A PR would be appreciated, but just to make sure we don't end up breaking any existing implementations: Hopefully it is evident from the code, but just in case I want to point out that this means handling errors based on their type or message, because of the way parallel processing is done.
Hopefully this helps in understanding the current code and implementing changes accordingly. Thanks |
Good day,
I have been using your nice library for Node app and React app both are running in production at the moment. Thanks for your great job.
One thing I noticed that if a
when
function throw an error. The error is being swallowed and easyRBAC returnfalse
instead!With that being siad, it is impossible to know if easyRBAC returns
false
becausewhen
function returnfalse
or because it throws an error.After debugging this library I found the issue in these lines:
https://github.com/DeadAlready/easy-rbac/blob/master/lib/rbac.js#L159
https://github.com/DeadAlready/easy-rbac/blob/master/lib/rbac.js#L176
https://github.com/DeadAlready/easy-rbac/blob/master/lib/utils.js#L19
https://github.com/DeadAlready/easy-rbac/blob/master/lib/utils.js#L29
If you agree with me that easyRBAC should not swallow errors and it should just re-throw errors back to the caller. I would be happy to provide PR if you are busy.
Thanks
The text was updated successfully, but these errors were encountered: