I am using Command Line Parser Library for C# console application. How I can retreive error messages if error occurs?
The use case is that this console app will be called from some another app and I want to provide to that app error message if some error occurs.
Here is a code snippet for parsing:
var options = new Options();
if (!CommandLine.Parser.Default.ParseArguments(args, options))
{
string errorMessage = ExctractParsingErrors();
GenerateErrorInvalidArguments(errorMessage);
Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
}
Inside function ExctractParsingErrors() I have to extract parsing error. Example output of that function could be "-i/--input required option is missing."
Any idea how I could manage to extract parsing errors?