Improves error reporting
Hey! We ran into an issue where we got an error from Oso. It looked like this:
Type error: Expected Instance
We've added this little hot patch here so that we get a more useful error message:
Type error: Expected Instance of service::auth::resources::Resource got String
The offending code was that we were using the wrong type in one place:
has_role(actor: User, “member”, resource: Resource) if
# bug: this should have been is_member_of(resource) instead
actor.is_member_of(resource.id);
But this was really hard to track down in a large Polar file with the previous error message.
In the future, we would maybe improve it to add some more context to the errors, such as line numbers. This would greatly improve the debugging experience.
Maybe look over the PR before merging it because I put it together quickly for debugging.
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA