From ea09ddfb001132a9a39d0211b0b8b4ef185e5ab4 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Tue, 4 Jul 2023 14:25:16 -0500 Subject: [PATCH] fix: Markup issue when printing exception message Just remove the special formatting for command runtime exception messages. Fixes #192 --- CHANGELOG.md | 4 ++++ src/Recyclarr.Cli/Program.cs | 12 +----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a173ffce..dd057c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `base_url` and `api_key` are now optional. These can be implicitly set via secrets that follow a naming convention. See the Secrets reference page on the wiki for details. +### Fixed + +- Resolved error during exception message formatting that occurred in some cases (#192). + ## [5.1.1] - 2023-06-29 ### Fixed diff --git a/src/Recyclarr.Cli/Program.cs b/src/Recyclarr.Cli/Program.cs index 9a6ac55d..0f5a4ded 100644 --- a/src/Recyclarr.Cli/Program.cs +++ b/src/Recyclarr.Cli/Program.cs @@ -1,5 +1,4 @@ using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; using Autofac; using Recyclarr.Cli.Console; using Recyclarr.Cli.Console.Helpers; @@ -11,7 +10,7 @@ using Spectre.Console.Cli; namespace Recyclarr.Cli; -internal static partial class Program +internal static class Program { private static ILifetimeScope? _scope; private static IBaseCommandSetupTask[] _tasks = Array.Empty(); @@ -53,12 +52,6 @@ internal static partial class Program { result = app.Run(args); } - catch (CommandRuntimeException ex) - { - var msg = CommandMessageRegex().Replace(ex.Message, "[gold1]$0[/]"); - AnsiConsole.Markup($"[red]Error:[/] [white]{msg}[/]"); - _log?.Debug(ex, "Command Exception"); - } catch (Exception ex) { AnsiConsole.WriteException(ex, ExceptionFormats.ShortenEverything); @@ -90,7 +83,4 @@ internal static partial class Program { _tasks.Reverse().ForEach(x => x.OnFinish()); } - - [GeneratedRegex("'.*?'", RegexOptions.None, 1000)] - private static partial Regex CommandMessageRegex(); }