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

Implement better Error types #507

Open
DevonMorris opened this issue Aug 20, 2024 · 3 comments
Open

Implement better Error types #507

DevonMorris opened this issue Aug 20, 2024 · 3 comments

Comments

@DevonMorris
Copy link
Contributor

Generally, it's frowned upon to have type-erased error types in library code.

Specifically, in your library, you've defined Solver::next_iter with an anyhow::Error as the error type. This means that even if I implement Solver on one of my own types and I've defined a custom error type, I'll have to to type erase that error type using anyhow and then try to dynamically downcast to get error-specific information out.

I propose that we refactor Solver to be generic over error types and that we implement custom error types for the solvers that currently exist.

A crate that would make this transition much easier is thiserror and we can additionally add miette for better diagnostics.

@stefan-k
Copy link
Member

This is something I haven't been happy with for a while and therefore I'm all for changing it as you proposed. Unfortunately the time I can invest in this is currently very limited. Would you be able to provide a PR?

@DevonMorris
Copy link
Contributor Author

I'll try to find some time in the evenings soon and work on this. Might be a couple of weeks before I get it wrapped, however.

@DevonMorris
Copy link
Contributor Author

Just an update, I took a first pass at this, but haven't gotten through the entire refactor. Work has ramped up again in the last little bit so I've found myself lacking time in the evenings.

All this to say, I haven't forgotten about this things have just been busy. Hopefully, I'll be able to make some time soon.

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

No branches or pull requests

2 participants