throw exception on parse errors
This commit is contained in:
parent
11b7e7e449
commit
204d8594bf
15 changed files with 48 additions and 21 deletions
|
@ -8,18 +8,21 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
{
|
||||
internal class CommandParsingException : Exception
|
||||
{
|
||||
private bool _isRequireSubCommandMissing;
|
||||
private readonly bool _isRequireSubCommandMissing;
|
||||
|
||||
public CommandParsingException(string message) : base(message)
|
||||
{
|
||||
Data.Add("CLI_User_Displayed_Exception", true);
|
||||
}
|
||||
|
||||
public CommandParsingException(
|
||||
CommandLineApplication command,
|
||||
string message,
|
||||
bool isRequireSubCommandMissing = false)
|
||||
: base(message)
|
||||
: this(message)
|
||||
{
|
||||
Command = command;
|
||||
_isRequireSubCommandMissing = isRequireSubCommandMissing;
|
||||
|
||||
Data.Add("CLI_User_Displayed_Exception", true);
|
||||
}
|
||||
|
||||
public CommandLineApplication Command { get; }
|
||||
|
@ -29,9 +32,9 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
|||
get
|
||||
{
|
||||
return _isRequireSubCommandMissing
|
||||
? CommonLocalizableStrings.RequiredCommandNotPassed
|
||||
: base.Message;
|
||||
? CommonLocalizableStrings.RequiredCommandNotPassed
|
||||
: base.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue