chore: improved exception messages
This commit is contained in:
parent
9af44d48b3
commit
62b43025b9
@ -7,13 +7,6 @@ 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, T2>(T to, T2? value)
|
||||
=> new($"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\""}");
|
||||
=> new($"Assign operation has failed on T: {to?.GetType().FullName ?? "\"null\""}, value: {value?.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}");
|
||||
|
@ -9,7 +9,7 @@ public class NotAssignedException : Exception
|
||||
public NotAssignedException(string? message) : base(message) { }
|
||||
|
||||
public static NotAssignedException From<T1, T2>(T1 to, T2? value) where T1 : IAssignable
|
||||
=> new($"{typeof(T2).Name} has not been assigned to {typeof(T1).Name}");
|
||||
=> new($"{value?.GetType().FullName ?? "\"null\""} has not been assigned to {to?.GetType().FullName ?? "\"null\""}");
|
||||
|
||||
public static void Check<T1, T2>(T1 to, T2? value) where T1 : IAssignable
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user