dotnet-installer/src/dotnet/CommandLine/CommandParsingException.cs

40 lines
1.2 KiB
C#
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.DotNet.Tools;
namespace Microsoft.DotNet.Cli.CommandLine
{
internal class CommandParsingException : Exception
{
2017-03-13 13:29:03 -07:00
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)
2017-03-13 13:29:03 -07:00
: this(message)
{
Command = command;
_isRequireSubCommandMissing = isRequireSubCommandMissing;
}
public CommandLineApplication Command { get; }
public override string Message
{
get
{
return _isRequireSubCommandMissing
2017-03-13 13:29:03 -07:00
? CommonLocalizableStrings.RequiredCommandNotPassed
: base.Message;
}
}
}
2017-03-13 13:29:03 -07:00
}