laatzen/Common/CommonCore/Exceptions/Web/TokenRequiredException.cs

40 lines
1.0 KiB
C#
Raw Normal View History

2021-10-01 09:09:20 +00:00
using System;
using System.Text;
2022-08-24 09:42:44 +00:00
namespace Xylem.Common.CommonCore.Exceptions.Web
2021-10-01 09:09:20 +00:00
{
public class TokenRequiredException : Exception, ICommonException
{
2022-08-24 09:42:44 +00:00
Guid? _lCode;
public TokenRequiredException(Guid? location = null)
2021-10-01 09:09:20 +00:00
{
2022-08-24 09:42:44 +00:00
_lCode = location;
2021-10-01 09:09:20 +00:00
}
2022-08-24 09:42:44 +00:00
public TokenRequiredException(String message, Guid? location = null)
2021-10-01 09:09:20 +00:00
: base(message)
{
2022-08-24 09:42:44 +00:00
_lCode = location;
2021-10-01 09:09:20 +00:00
}
2022-08-24 09:42:44 +00:00
public TokenRequiredException(String message, Exception inner, Guid? location = null)
2021-10-01 09:09:20 +00:00
: base(message, inner)
{
2022-08-24 09:42:44 +00:00
_lCode = location;
2021-10-01 09:09:20 +00:00
}
2022-08-24 09:42:44 +00:00
public String GetHelpText()
2021-10-01 09:09:20 +00:00
{
var sb = new StringBuilder();
2022-08-24 09:42:44 +00:00
sb.AppendLine("Token is required for locked meter.");
sb.AppendLine("Add token too your local key store.");
2021-10-01 09:09:20 +00:00
2022-08-24 09:42:44 +00:00
if (_lCode.HasValue)
2021-10-01 09:09:20 +00:00
{
2022-08-24 09:42:44 +00:00
sb.AppendLine($"LCode:{_lCode.Value}");
2021-10-01 09:09:20 +00:00
}
return sb.ToString();
}
}
}