From b9f7433d77170181b81f9432bb3d68151a1dfa47 Mon Sep 17 00:00:00 2001 From: Vladislav Mamon Date: Sun, 7 Apr 2024 13:22:49 +0300 Subject: [PATCH] refactor(app): move miette hook setup --- src/app.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app.rs b/src/app.rs index 8558c0c..92fbbfe 100644 --- a/src/app.rs +++ b/src/app.rs @@ -104,6 +104,17 @@ impl App { /// Runs the app and prints any errors. pub async fn run(&mut self) { + miette::set_hook(Box::new(|_| { + Box::new( + miette::MietteHandlerOpts::new() + .terminal_links(false) + .context_lines(3) + .tab_width(4) + .build(), + ) + })) + .expect("Failed to set up the miette hook"); + let scaffold_res = self.scaffold().await; if scaffold_res.is_err() { @@ -114,17 +125,6 @@ impl App { /// Kicks of the scaffolding process. pub async fn scaffold(&mut self) -> miette::Result<()> { - // Slightly tweak miette. - miette::set_hook(Box::new(|_| { - Box::new( - miette::MietteHandlerOpts::new() - .terminal_links(false) - .context_lines(3) - .tab_width(4) - .build(), - ) - }))?; - // Build override options. let overrides = ConfigOptionsOverrides { delete: self.cli.delete };