Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the reporting error when config file does not exist #192

Closed
1 task done
fabricionaweb opened this issue Jul 4, 2023 · 1 comment
Closed
1 task done
Labels
bug Something isn't working

Comments

@fabricionaweb
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Calling the program with --config that points to a non-exist file throw an useless message

I could debug a bit and It seems like it is a message inside the throw that needs to be escaped

--- a/src/Recyclarr.Cli/Program.cs
+++ b/src/Recyclarr.Cli/Program.cs
@@ -56,7 +56,7 @@ internal static partial class Program
         catch (CommandRuntimeException ex)
         {
             var msg = CommandMessageRegex().Replace(ex.Message, "[gold1]$0[/]");
-            AnsiConsole.Markup($"[red]Error:[/] [white]{msg}[/]");
+            AnsiConsole.Markup($"[red]Error:[/] [white]{msg.EscapeMarkup()}[/]");
             _log?.Debug(ex, "Command Exception");
         }
         catch (Exception ex)

That reports me the following message:

$ ./publish/recyclarr sync --config /not-found/config.yml
Error: Failed to convert [gold1]'/path-to-a-not-found.yml'[/] to 
IFileInfo[].

But still not that great. As Im not dotnet developer, I dont know what to do.

Expected Behavior

Throw an more friendly and useful message

Steps To Reproduce

recyclarr sync -c /path-to-a-not-found.yml

Environment & Versions

- Operating System: MacOS or Linux
- Architecture: arm64 or x64
- Recyclarr Version: 5.1.1+Branch.tags-v5.1.1.Sha.4d0ce0d09f367ce2520eca53c4043568efa328fd
- Recyclarr Build:

Recyclarr Log File(s)

Unhandled exception. System.InvalidOperationException: Could not find color or style ''.
   at Spectre.Console.StyleParser.Parse(String text) in /_/src/Spectre.Console/StyleParser.cs:line 10
   at Spectre.Console.MarkupParser.Parse(String text, Style style) in /_/src/Spectre.Console/Internal/Text/Markup/MarkupParser.cs:line 29
   at Spectre.Console.AnsiConsoleExtensions.Markup(IAnsiConsole console, String value) in /_/src/Spectre.Console/Extensions/AnsiConsoleExtensions.Markup.cs:line 77
   at Spectre.Console.AnsiConsole.Markup(String value) in /_/src/Spectre.Console/AnsiConsole.Markup.cs:line 14
   at Recyclarr.Cli.Program.Main(String[] args) in /home/runner/work/recyclarr/recyclarr/src/Recyclarr.Cli/Program.cs:line 59
[1]    9859 IOT instruction  recyclarr sync -c /path-to-a-not-found.yml

Configuration YAML

do not apply - it needs to not exist

Sonarr / Radarr Logs

No response

@fabricionaweb fabricionaweb added the bug Something isn't working label Jul 4, 2023
@rcdailey
Copy link
Member

rcdailey commented Jul 4, 2023

This is a really solid bug report! Thank you! I will have this fixed today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants