using System; using Syntriax.Engine.Core.Abstract; namespace Syntriax.Engine.Core.Exceptions; public class NotAssignedException : Exception { public NotAssignedException() : base("The object has not been assigned.") { } public NotAssignedException(string? message) : base(message) { } public static NotAssignedException From(T1 to, T2? value) where T1 : IAssignable => new NotAssignedException($"{typeof(T2).Name} has not been assigned to {typeof(T1).Name}"); public static void Check(T1 to, T2? value) where T1 : IAssignable { if (value is not null) return; throw From(to, value); } }