diff --git a/src/Executors/EcsWhereExecutor.cs b/src/Executors/EcsWhereExecutor.cs index 47d43ab..a2d89ce 100644 --- a/src/Executors/EcsWhereExecutor.cs +++ b/src/Executors/EcsWhereExecutor.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +using DCFApixels.DragonECS.Internal; +using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { @@ -52,8 +53,8 @@ namespace DCFApixels.DragonECS { #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS //_executeMarker.Begin(); - if (span.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения. - if (span.WorldID != WorldID) throw new System.ArgumentException();//TODO составить текст исключения. + if (span.IsNull) { Throw.ArgumentNull(nameof(span)); } + if (span.WorldID != WorldID) { Throw.Quiery_ArgumentDifferentWorldsException(); } #endif EcsSpan result; if (_lastWorldVersion != World.Version) diff --git a/src/Executors/EcsWhereToGroupExecutor.cs b/src/Executors/EcsWhereToGroupExecutor.cs index f275cfe..e9e280c 100644 --- a/src/Executors/EcsWhereToGroupExecutor.cs +++ b/src/Executors/EcsWhereToGroupExecutor.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +using DCFApixels.DragonECS.Internal; +using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { @@ -54,8 +55,8 @@ namespace DCFApixels.DragonECS { #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS _executeMarker.Begin(); - if (span.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения. - if (span.WorldID != WorldID) throw new System.ArgumentException();//TODO составить текст исключения. + if (span.IsNull) { Throw.ArgumentNull(nameof(span)); } + if (span.WorldID != WorldID) { Throw.Quiery_ArgumentDifferentWorldsException(); } #endif if (_lastWorldVersion != World.Version) { diff --git a/src/Utils/Exceptions.cs b/src/Utils/Exceptions.cs index 15c1d04..4530c56 100644 --- a/src/Utils/Exceptions.cs +++ b/src/Utils/Exceptions.cs @@ -113,9 +113,19 @@ namespace DCFApixels.DragonECS.Internal internal static void Ent_ThrowIsNotAlive(entlong entity) { if (entity.IsNull) + { throw new EcsFrameworkException($"The {entity} is null."); + } else + { throw new EcsFrameworkException($"The {entity} is not alive."); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + internal static void Quiery_ArgumentDifferentWorldsException() + { + throw new ArgumentException("The groups belong to different worlds."); } @@ -125,6 +135,11 @@ namespace DCFApixels.DragonECS.Internal throw new ArgumentNullException(); } [MethodImpl(MethodImplOptions.NoInlining)] + internal static void ArgumentNull(string paramName) + { + throw new ArgumentNullException(paramName); + } + [MethodImpl(MethodImplOptions.NoInlining)] internal static void ArgumentOutOfRange() { throw new ArgumentOutOfRangeException($"index is less than 0 or is equal to or greater than Count.");