Skip to content

How to display the error message without returning from main #61

Answered by zkat
p-iranha asked this question in Q&A
Discussion options

You must be logged in to vote

This should work fine:

use miette::Context;
let msg = match some_fn().context("Turning this into a Report") {
  Ok(()) => {"ok".to_string()}
  Err(err) => format!("err: {:?}", err),
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cylixlee
Comment options

@zkat
Comment options

zkat Mar 17, 2024
Maintainer

Answer selected by zkat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants