85 lines
3.0 KiB
C#
85 lines
3.0 KiB
C#
namespace Lattice.Core.DragDrop.Exceptions;
|
||
|
||
/// <summary>
|
||
/// Исключение, возникающее при ошибках в системе перетаскивания.
|
||
/// </summary>
|
||
public class DragDropException : Exception
|
||
{
|
||
/// <summary>
|
||
/// Код ошибки.
|
||
/// </summary>
|
||
public string ErrorCode { get; }
|
||
|
||
/// <summary>
|
||
/// Инициализирует новый экземпляр класса <see cref="DragDropException"/>.
|
||
/// </summary>
|
||
public DragDropException()
|
||
: base("Drag & Drop operation failed.")
|
||
{
|
||
ErrorCode = "DRAGDROP_0001";
|
||
}
|
||
|
||
/// <summary>
|
||
/// Инициализирует новый экземпляр класса <see cref="DragDropException"/> с указанным сообщением.
|
||
/// </summary>
|
||
public DragDropException(string message)
|
||
: base(message)
|
||
{
|
||
ErrorCode = "DRAGDROP_0002";
|
||
}
|
||
|
||
/// <summary>
|
||
/// Инициализирует новый экземпляр класса <see cref="DragDropException"/> с кодом ошибки.
|
||
/// </summary>
|
||
public DragDropException(string errorCode, string message)
|
||
: base(message)
|
||
{
|
||
ErrorCode = errorCode;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Инициализирует новый экземпляр класса <see cref="DragDropException"/>
|
||
/// с указанным сообщением и внутренним исключением.
|
||
/// </summary>
|
||
public DragDropException(string message, Exception innerException)
|
||
: base(message, innerException)
|
||
{
|
||
ErrorCode = "DRAGDROP_0003";
|
||
}
|
||
|
||
/// <summary>
|
||
/// Инициализирует новый экземпляр класса <see cref="DragDropException"/>
|
||
/// с кодом ошибки, сообщением и внутренним исключением.
|
||
/// </summary>
|
||
public DragDropException(string errorCode, string message, Exception innerException)
|
||
: base(message, innerException)
|
||
{
|
||
ErrorCode = errorCode;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Коды ошибок Drag and Drop системы.
|
||
/// </summary>
|
||
public static class DragDropErrorCodes
|
||
{
|
||
// Общие ошибки
|
||
public const string OperationAlreadyActive = "DRAGDROP_1001";
|
||
public const string OperationNotActive = "DRAGDROP_1002";
|
||
public const string InvalidData = "DRAGDROP_1003";
|
||
public const string Timeout = "DRAGDROP_1004";
|
||
|
||
// Ошибки источников
|
||
public const string SourceCannotDrag = "DRAGDROP_2001";
|
||
public const string SourceStartFailed = "DRAGDROP_2002";
|
||
|
||
// Ошибки целей
|
||
public const string TargetNotFound = "DRAGDROP_3001";
|
||
public const string TargetCannotAccept = "DRAGDROP_3002";
|
||
public const string TargetDropFailed = "DRAGDROP_3003";
|
||
|
||
// Ошибки системы
|
||
public const string SystemNotInitialized = "DRAGDROP_4001";
|
||
public const string SystemDisposed = "DRAGDROP_4002";
|
||
public const string MemoryAllocationFailed = "DRAGDROP_4003";
|
||
} |