Skip to content

Feature Request: Support ensure! without error message like anyhow. #432

@oxcrow

Description

@oxcrow

Hello,

Would it be possible to allow the use of ensure! macro without an error message.

Sometimes I just want to write the assertion test without worrying about creating a pretty error message.

There are many instances where it is preferable to not provide an error message with ensure!.

  • While debugging something and writing quick tests for it.
  • While writing assertions.
  • While writing unit tests.
  • etc.

It would help if that was supported by miette.

Anyhow supports this feature.

The code would look like...

macro_rules! ensure {
  ($condition: expr) => {
       miette::ensure!($condition, "ensure failed");
  }
}

Thank you
~ oxcrow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions