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

Add more descriptive error to Observer #388

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Raild3x
Copy link
Contributor

@Raild3x Raild3x commented Oct 11, 2024

Currently if you give a scope, but not a state to watch, the Observer errors out telling you that your scope is missing. This led me on a goose chase trying to figure out why it wasn't able to find my scope. Turned out it wasn't the scope, but the state that was missing.
This change aims to just adjust the error message displayed in this edge case. I wasn't sure how best to log the error, feel free to adjust.

@dphfox
Copy link
Owner

dphfox commented Oct 27, 2024

This actually introduces the opposite problem - if an Observer is given a UsedAs value that is not StateObject, it now throws the wrong error with this change.

To solve this issue, we'd probably need to measure the arity of the function call directly, probably using variadics somehow.

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