dotnet-installer/src/Microsoft.DotNet.ProjectJsonMigration/MigrationError.cs

31 lines
893 B
C#
Raw Normal View History

2016-09-21 17:27:02 -07:00
// 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.
2016-08-23 13:50:05 -07:00
namespace Microsoft.DotNet.ProjectJsonMigration
{
public class MigrationError
{
public string ErrorCode { get; }
public string GeneralErrorReason { get; }
public string Message { get; }
public MigrationError(string errorCode, string generalErrorReason, string message)
{
ErrorCode = errorCode;
GeneralErrorReason = generalErrorReason;
Message = message;
}
public void Throw()
{
2016-09-21 17:27:02 -07:00
throw new MigrationException(GetFormattedErrorMessage());
2016-08-23 13:50:05 -07:00
}
public string GetFormattedErrorMessage()
{
return $"{ErrorCode}::{GeneralErrorReason}: {Message}";
}
}
}