-
Sorry if it's a bit silly, but I'm trying to using miette on this toy language that I'm writting, and I'm trying to print the error messages inside of a REPL, but I can't find in the documentation a way of pretty-print the report, beyond lifting the error up to main and exiting the program. More specifically, I was expecting for this piece of code: match interpret(&buf, debug_flag) { // interpret returns miette::Result
Ok(val) => println!("{:#?}", val),
Err(err) => println!("{}", err),
} To pretty-print the error with snippets and all, but it just prints the message I defined in the Hope I could explain my problem clearly, if not, please ask, I would love some help. Miette is pretty cool and being able to have such nice error messages in my toy language feels like a super power 😅 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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),
} |
Beta Was this translation helpful? Give feedback.
This should work fine: