Cysharp / ConsoleAppFramework

Zero Dependency, Zero Overhead, Zero Reflection, Zero Allocation, AOT Safe CLI Framework powered by C# Source Generator.
MIT License
1.54k stars 88 forks source link

Do not print the stack trace for `ArgumentException` #112

Closed xPaw closed 1 month ago

xPaw commented 1 month ago

Since it's being thrown by the generated code and is expected to be visible by the user, I don't think the stacktrace provides any value.

Current:

System.ArgumentException: Argument '-abc' does not found in command prameters.
   at ConsoleAppFramework.ConsoleApp.ThrowArgumentNameNotFound(String argumentName) in ConsoleApp.cs:line 110
   at ConsoleAppFramework.ConsoleApp.Run(String[] args, Func`15 command) in ConsoleApp.Run.g.cs:line 242

Suggestion:

Argument '-abc' does not found in command prameters.
neuecc commented 1 month ago

Thank you. I cannot give ArgumentException special treatment, so I plan to change the exception being thrown to a custom one (ParseFailedException?) and modify it to only output the message!

neuecc commented 1 month ago

v5.1.1 throws ArgumentParseFailedException and only shows message.