ES-22: Provide `OptionExt::ok_or_report` to create reports with a given context for `None`
I think this would be nice to have vs. ok_or_else() + deliberate Report::new()
Quickly created this issue on my phone, while I was thinking about it. If you accept contributions Iād be happy to contribute this, if you all are amenable to the idea.
Hi @jnicholls! Thanks for the issue, and, yes, we'd love to see contributions!
However, we intentionally did not provide OptionExt to convert Option::None to Report. This decision was made because an Option does not have an error to create a Report from (this is the same reason, why eyre does not provide it).
@TimDiekmann eyre has an OptionExt::ok_or_eyre So I'd expect something like OptionExt::ok_or_report(IntoReport)
I actually never thought about ok_or_report. A quite low-hanging fruit without unambiguity. Let's just do it!
Are there any open-source volunteers available? Iām unlikely to be able to work on it in the next 1-2 weeks.