Skip to content

Improves error reporting#1699

Open
xfbs wants to merge 2 commits intoosohq:mainfrom
xfbs-fork:errors
Open

Improves error reporting#1699
xfbs wants to merge 2 commits intoosohq:mainfrom
xfbs-fork:errors

Conversation

@xfbs
Copy link
Copy Markdown
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
Copy Markdown

github-actions Bot commented May 2, 2023

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

@alisomay
Copy link
Copy Markdown

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