Skip to content

Custom errors for HasClient, HasServer #1486

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

Merged
merged 2 commits into from
Jan 18, 2022
Merged

Custom errors for HasClient, HasServer #1486

merged 2 commits into from
Jan 18, 2022

Conversation

gdeest
Copy link
Contributor

@gdeest gdeest commented Nov 18, 2021

This PR applies the approach from #1289 to HasServer and HasClient.

The context parameter is missing from the missing instance message in one case, but I am not sure it is a big enough problem to warrant making the code more complex.

In the process, I realized there was already a similar mechanism in place to detect usage errors for HasServer. The mechanism #1289 supersedes it, as it produces more informative messages, displays the number of missing parameters, etc.

@gdeest gdeest marked this pull request as ready for review November 18, 2021 12:55
@gdeest
Copy link
Contributor Author

gdeest commented Jan 18, 2022

OK, I consider the issue of the missing context parameter relatively benign: we are not pattern-matching on the context, but on the API ; the context is irrelevant to the error message, so I'd rather avoid making the error generation machinery more complex for little reason.

Moreover, since we are talking about type errors, we can decide to change how these are generated at any point without consequence on our users, so I am going to merge.

@gdeest gdeest merged commit 75db4a5 into master Jan 18, 2022
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.

1 participant