Skip to content
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

Improves error reporting #1699

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Improves error reporting #1699

wants to merge 2 commits into from

Conversation

xfbs
Copy link
Contributor

@xfbs xfbs commented May 2, 2023

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.

@github-actions
Copy link

github-actions bot commented May 2, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@alisomay
Copy link

alisomay commented May 2, 2023

I have read the CLA Document and I hereby sign the CLA

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

Successfully merging this pull request may close these issues.

2 participants