-
Notifications
You must be signed in to change notification settings - Fork 69
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
Breaking Change: Change prompt
function error return type
#22
Comments
Hi! At the moment we do use a custom error type that is returned on all prompts: InquireError. I also tried to see if the current implementation is missing something, implementing this PoC: https://github.com/mikaelmello/eyre-inquire-poc. But it all seems to be working. I'm not sure if I missed anything from your issue, could you provide some examples? Also, I added a custom error type on v0.0.4, so I considered that you might be using a version older than that, which would make me very surprised to know people knew about the lib back then! |
I apparently somehow pulled in |
No bother at all! Please let me know if you have any other issues. The last couple versions (specially 0.0.8) included huge rewrites for new features :) |
Is your feature request related to a problem? Please describe.
I'm testing out inquire in a cli app of mine and at least initially I want to just propagate errors back to main and print them with
eyre::Report
but the current choice of error return type (Box<dyn Error>
) is making this impossible. The issue is two fold. The main issue being thatBox<dyn Error>
doesn't implement theError
trait so it can't be converted into aneyre::Report
throughFrom
. I could work around this normally by using theeyre!
macro to manually convert the boxed error into a report but this doesn't work becauseBox<dyn Error>
also doesn't implementSend
orSync
, which is required to be stored in aneyre::Report
at all. This second problem could be fixed by just changing the signature toBox<dyn Error + Send + Sync + 'static>
but that still wouldn't solve theFrom
incompatibility, which is intrinsic toBox
itself.Describe the solution you'd like
Ideally I'd recommend introducing your own
Error
type and implement theError
trait for it. It's too early for me to say yet how it should be structured or what interface it should present, other than an opaque error type that implementsSend
,Sync
, andError
. Ideally I'd start there, even if theError
type internally just stores aBox<dyn Error + Send + Sync + 'static>
and is used the same way the current error type is.The text was updated successfully, but these errors were encountered: