Repository navigation
ES-22: Provide OptionExt::ok_or_report to create reports with a given context for None #667
Description
Activity
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.
- addedarea/libs > error-stackAffects the `error-stack` crate (library)Affects the `error-stack` crate (library)
on Jun 17, 2022 Hi @jnicholls! Thanks for the issue, and, yes, we'd love to see contributions!
However, we intentionally did not provide
OptionExtto convertOption::NonetoReport. This decision was made because anOptiondoes not have an error to create aReportfrom (this is the same reason, whyeyredoes not provide it).- addedstate/rejectedThis issue will not be worked on (previously "Won't Fix")This issue will not be worked on (previously "Won't Fix")
on Jun 17, 2022 @TimDiekmann eyre has an OptionExt::ok_or_eyre So I'd expect something like OptionExt::ok_or_report(IntoReport)
See fast/exn@cf0bc9d.
I actually never thought about
ok_or_report. A quite low-hanging fruit without unambiguity. Let's just do it!Reacted by tison- changed the title
[-]error-stack: Provide an OptionExt to create reports with a given context for Option::None[/-][+]ES-22: Provide `OptionExt::ok_or_report` to create reports with a given context for `None`[/+]on Oct 13, 2025 Are there any open-source volunteers available? I’m unlikely to be able to work on it in the next 1-2 weeks.
- addedpriority/3 lowLower priority: nice-to-haveLower priority: nice-to-havearea/libsRelates to first-party libraries/crates/packages (area)Relates to first-party libraries/crates/packages (area)area/dxImprovements or additions to DX or docsImprovements or additions to DX or docsand removedstate/rejectedThis issue will not be worked on (previously "Won't Fix")This issue will not be worked on (previously "Won't Fix")
on Oct 15, 2025
I think this would be nice to have vs.
ok_or_else()+ deliberateReport::new()