fix: Markup issue when printing exception message

Just remove the special formatting for command runtime exception
messages.

Fixes #192
pull/201/head
Robert Dailey 10 months ago
parent abcf4f7d8f
commit ea09ddfb00

@ -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

@ -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<IBaseCommandSetupTask>();
@ -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();
}

Loading…
Cancel
Save