This commit is contained in:
Mikhail 2024-08-05 11:13:13 +08:00
parent 9c2fe13194
commit e42d2edbbf
3 changed files with 23 additions and 6 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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.");