using System; using Syntriax.Engine.Core.Abstract; namespace Syntriax.Engine.Core.Exceptions; public class AssignException : Exception { public AssignException() : base("Assign operation has failed.") { } public AssignException(string? message) : base(message) { } // public static AssignException FromStateEnable(IStateEnable? stateEnable) // => new AssignException($"{nameof(IGameObject.AssignStateEnable)} failed on type {stateEnable?.GetType().ToString() ?? "\"null\""}"); public static AssignException From(T to, T2? value) => new AssignException($"Assign operation has failed on T: {typeof(T).FullName}, value: {value?.GetType().ToString() ?? "\"null\""}"); // public static AssignException FromBehaviourController(IBehaviourController? behaviourController) // => new AssignException($"{nameof(IGameObject.AssignBehaviourController)} failed on type {behaviourController?.GetType().ToString() ?? "\"null\""}"); } // throw new Exception($"{nameof(IGameObject.AssignTransform)} failed on type {transform?.GetType().ToString() ?? "null"} for type {typeof(T).FullName}"); // throw new Exception($"{nameof(IGameObject.AssignBehaviourController)} failed on type {behaviourController?.GetType().ToString() ?? "null"} for type {typeof(T).FullName}"); // throw new Exception($"{nameof(IGameObject.AssignStateEnable)} failed on type {stateEnable?.GetType().ToString() ?? "null"} for type {typeof(T).FullName}");