You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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?
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.
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 ananyhow::Error
as the error type. This means that even if I implementSolver
on one of my own types and I've defined a custom error type, I'll have to to type erase that error type usinganyhow
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.
The text was updated successfully, but these errors were encountered: