Skip to content

ES-22: Provide OptionExt::ok_or_report to create reports with a given context for None #667

Description

@jnicholls

I think this would be nice to have vs. ok_or_else() + deliberate Report::new()

Activity

  1. jnicholls commented on Jun 17, 2022

    @jnicholls
    Author

    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.

  2. TimDiekmann commented on Jun 17, 2022

    @TimDiekmann
    Member

    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).

  3. tisonkun commented on Oct 10, 2025

    @tisonkun

    @TimDiekmann eyre has an OptionExt::ok_or_eyre So I'd expect something like OptionExt::ok_or_report(IntoReport)

    See fast/exn@cf0bc9d.

  4. TimDiekmann commented on Oct 13, 2025

    @TimDiekmann
    Member

    I actually never thought about ok_or_report. A quite low-hanging fruit without unambiguity. Let's just do it!

  5. 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
  6. TimDiekmann commented on Oct 14, 2025

    @TimDiekmann
    Member

    Are there any open-source volunteers available? I’m unlikely to be able to work on it in the next 1-2 weeks.

  7. added
    priority/3 lowLower priority: nice-to-have
    area/libsRelates to first-party libraries/crates/packages (area)
    area/dxImprovements or additions to DX or docs
    and removed
    state/rejectedThis issue will not be worked on (previously "Won't Fix")
    on Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/dxImprovements or additions to DX or docsarea/libsRelates to first-party libraries/crates/packages (area)area/libs > error-stackAffects the `error-stack` crate (library)priority/3 lowLower priority: nice-to-have

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions