Files
Lattice/Lattice.Core.DragDrop/Exceptions/DragDropException.cs
2026-01-18 16:33:35 +03:00

85 lines
3.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 & 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";
}