From 79f9f59a87c10bd85c7a31f4b5017bce5bfbbeb1 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Wed, 24 Aug 2022 13:54:47 +0200 Subject: Fix various C# exceptions - Replace `IndexOutOfRangeException` with `ArgumentOutOfRangeException` - Replace `Exception` with a more specific exception - Add the parameter name to argument exception - Update documentation for methods that throw exceptions - Use `StringBuilder` to build exception messages - Ensure exception messages end with a period --- modules/mono/glue/GodotSharp/GodotPlugins/Main.cs | 2 +- .../mono/glue/GodotSharp/GodotSharp/Core/AABB.cs | 3 +++ .../mono/glue/GodotSharp/GodotSharp/Core/Array.cs | 2 +- .../mono/glue/GodotSharp/GodotSharp/Core/Basis.cs | 11 +++++--- .../mono/glue/GodotSharp/GodotSharp/Core/Color.cs | 2 +- .../glue/GodotSharp/GodotSharp/Core/Dictionary.cs | 8 +++--- .../GodotSharp/Core/DisposablesTracker.cs | 4 +-- .../GodotSharp/Core/Extensions/NodeExtensions.cs | 8 +++--- .../Core/Extensions/PackedSceneExtensions.cs | 2 +- .../Core/Extensions/ResourceLoaderExtensions.cs | 2 +- .../GodotSharp/Core/NativeInterop/NativeFuncs.cs | 4 +-- .../GodotSharp/Core/Object.exceptions.cs | 31 +++++++++++++--------- .../glue/GodotSharp/GodotSharp/Core/Projection.cs | 14 +++++++--- .../glue/GodotSharp/GodotSharp/Core/Quaternion.cs | 15 ++++++----- .../glue/GodotSharp/GodotSharp/Core/Transform2D.cs | 3 +++ .../glue/GodotSharp/GodotSharp/Core/Transform3D.cs | 3 +++ .../glue/GodotSharp/GodotSharp/Core/Vector2.cs | 6 ++--- .../glue/GodotSharp/GodotSharp/Core/Vector2i.cs | 4 +-- .../glue/GodotSharp/GodotSharp/Core/Vector3.cs | 8 +++--- .../glue/GodotSharp/GodotSharp/Core/Vector3i.cs | 4 +-- .../glue/GodotSharp/GodotSharp/Core/Vector4.cs | 8 +++--- .../glue/GodotSharp/GodotSharp/Core/Vector4i.cs | 8 +++--- 22 files changed, 90 insertions(+), 62 deletions(-) (limited to 'modules/mono/glue/GodotSharp') diff --git a/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs b/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs index dad7464410..8308bada24 100644 --- a/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs +++ b/modules/mono/glue/GodotSharp/GodotPlugins/Main.cs @@ -153,7 +153,7 @@ namespace GodotPlugins string assemblyPath = new(nAssemblyPath); if (_editorApiAssembly == null) - throw new InvalidOperationException("The Godot editor API assembly is not loaded"); + throw new InvalidOperationException("The Godot editor API assembly is not loaded."); var (assembly, _) = LoadPlugin(assemblyPath); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs index f87f37bc43..33fec350e3 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs @@ -145,6 +145,9 @@ namespace Godot /// Gets the position of one of the 8 endpoints of the . /// /// Which endpoint to get. + /// + /// is less than 0 or greater than 7. + /// /// An endpoint of the . public Vector3 GetEndpoint(int idx) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs index f2984bd1fb..1c98dfcdf6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs @@ -510,7 +510,7 @@ namespace Godot.Collections if (_convertToVariantCallback == null || _convertToManagedCallback == null) { throw new InvalidOperationException( - $"The array element type is not supported for conversion to Variant: '{typeof(T).FullName}'"); + $"The array element type is not supported for conversion to Variant: '{typeof(T).FullName}'."); } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs index 4cb9bf5758..0fdd73cc5b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs @@ -148,6 +148,9 @@ namespace Godot /// Access whole columns in the form of . /// /// Which column vector. + /// + /// is not 0, 1, 2 or 3. + /// /// The basis column. public Vector3 this[int column] { @@ -366,8 +369,8 @@ namespace Godot /// but are more efficient for some internal calculations. /// /// Which row. - /// - /// Thrown when the is not 0, 1 or 2. + /// + /// is not 0, 1 or 2. /// /// One of Row0, Row1, or Row2. public Vector3 GetRow(int index) @@ -391,8 +394,8 @@ namespace Godot /// /// Which row. /// The vector to set the row to. - /// - /// Thrown when the is not 0, 1 or 2. + /// + /// is not 0, 1 or 2. /// public void SetRow(int index, Vector3 value) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs index ed0e1efd35..884dbb9fb2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs @@ -595,7 +595,7 @@ namespace Godot /// /// A string for the HTML hexadecimal representation of this color. /// - /// Thrown when the given color code is invalid. + /// color code is invalid. /// private static Color FromHTML(string rgba) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs index 95ad097192..93103d0f6b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs @@ -171,7 +171,7 @@ namespace Godot.Collections var self = (godot_dictionary)NativeValue; if (NativeFuncs.godotsharp_dictionary_contains_key(ref self, variantKey).ToBool()) - throw new ArgumentException("An element with the same key already exists", nameof(key)); + throw new ArgumentException("An element with the same key already exists.", nameof(key)); godot_variant variantValue = (godot_variant)value.NativeVar; NativeFuncs.godotsharp_dictionary_add(ref self, variantKey, variantValue); @@ -381,13 +381,13 @@ namespace Godot.Collections if (_convertKeyToVariantCallback == null || _convertKeyToManagedCallback == null) { throw new InvalidOperationException( - $"The dictionary key type is not supported for conversion to Variant: '{typeof(TKey).FullName}'"); + $"The dictionary key type is not supported for conversion to Variant: '{typeof(TKey).FullName}'."); } if (_convertValueToVariantCallback == null || _convertValueToManagedCallback == null) { throw new InvalidOperationException( - $"The dictionary value type is not supported for conversion to Variant: '{typeof(TValue).FullName}'"); + $"The dictionary value type is not supported for conversion to Variant: '{typeof(TValue).FullName}'."); } } @@ -556,7 +556,7 @@ namespace Godot.Collections var self = (godot_dictionary)_underlyingDict.NativeValue; if (NativeFuncs.godotsharp_dictionary_contains_key(ref self, variantKey).ToBool()) - throw new ArgumentException("An element with the same key already exists", nameof(key)); + throw new ArgumentException("An element with the same key already exists.", nameof(key)); using var variantValue = _convertValueToVariantCallback(value); NativeFuncs.godotsharp_dictionary_add(ref self, variantKey, variantValue); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs index 75793ea446..421b588560 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs @@ -83,13 +83,13 @@ namespace Godot public static void UnregisterGodotObject(Object godotObject, WeakReference weakReferenceToSelf) { if (!GodotObjectInstances.TryRemove(weakReferenceToSelf, out _)) - throw new ArgumentException("Godot Object not registered", nameof(weakReferenceToSelf)); + throw new ArgumentException("Godot Object not registered.", nameof(weakReferenceToSelf)); } public static void UnregisterDisposable(WeakReference weakReference) { if (!OtherInstances.TryRemove(weakReference, out _)) - throw new ArgumentException("Disposable not registered", nameof(weakReference)); + throw new ArgumentException("Disposable not registered.", nameof(weakReference)); } } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs index df0e839866..03996bafdd 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs @@ -36,7 +36,7 @@ namespace Godot /// /// The path to the node to fetch. /// - /// Thrown when the given the fetched node can't be casted to the given type . + /// The fetched node can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . /// @@ -100,7 +100,7 @@ namespace Godot /// parameter in ). /// /// - /// Thrown when the given the fetched node can't be casted to the given type . + /// The fetched node can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . /// @@ -142,7 +142,7 @@ namespace Godot /// /// /// - /// Thrown when the given the fetched node can't be casted to the given type . + /// The fetched node can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . /// @@ -176,7 +176,7 @@ namespace Godot /// /// /// - /// Thrown when the given the fetched node can't be casted to the given type . + /// The fetched node can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . /// diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs index 435b59d5f3..8463403096 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/PackedSceneExtensions.cs @@ -11,7 +11,7 @@ namespace Godot /// /// /// - /// Thrown when the given the instantiated node can't be casted to the given type . + /// The instantiated node can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . /// The instantiated scene. diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs index 25c11d5cf6..b246e56fa9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs @@ -19,7 +19,7 @@ namespace Godot /// Returns an empty resource if no could handle the file. /// /// - /// Thrown when the given the loaded resource can't be casted to the given type . + /// The loaded resource can't be casted to the given type . /// /// The type to cast to. Should be a descendant of . public static T Load(string path, string typeHint = null, CacheMode cacheMode = CacheMode.Reuse) where T : class diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index 6d2534e6f7..939c0056ac 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -22,11 +22,11 @@ namespace Godot.NativeInterop public static void Initialize(IntPtr unmanagedCallbacks, int unmanagedCallbacksSize) { if (initialized) - throw new InvalidOperationException("Already initialized"); + throw new InvalidOperationException("Already initialized."); initialized = true; if (unmanagedCallbacksSize != sizeof(UnmanagedCallbacks)) - throw new ArgumentException("Unmanaged callbacks size mismatch"); + throw new ArgumentException("Unmanaged callbacks size mismatch.", nameof(unmanagedCallbacksSize)); _unmanagedCallbacks = Unsafe.AsRef((void*)unmanagedCallbacks); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs index eb2811c73d..0fcc4ee01b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Object.exceptions.cs @@ -1,4 +1,5 @@ using System; +using System.Text; #nullable enable @@ -60,19 +61,22 @@ namespace Godot { get { - string s = base.Message; - - if (string.IsNullOrEmpty(s)) + StringBuilder sb; + if (string.IsNullOrEmpty(base.Message)) + { + sb = new(Arg_NativeConstructorNotFoundException); + } + else { - s = Arg_NativeConstructorNotFoundException; + sb = new(base.Message); } if (!string.IsNullOrEmpty(_nativeClassName)) { - s += " " + string.Format("(Class '{0}')", _nativeClassName); + sb.Append($" (Method '{_nativeClassName}')"); } - return s; + return sb.ToString(); } } } @@ -115,19 +119,22 @@ namespace Godot { get { - string s = base.Message; - - if (string.IsNullOrEmpty(s)) + StringBuilder sb; + if (string.IsNullOrEmpty(base.Message)) + { + sb = new(Arg_NativeMethodBindNotFoundException); + } + else { - s = Arg_NativeMethodBindNotFoundException; + sb = new(base.Message); } if (!string.IsNullOrEmpty(_nativeMethodName)) { - s += " " + string.Format("(Method '{0}')", _nativeMethodName); + sb.Append($" (Method '{_nativeMethodName}')"); } - return s; + return sb.ToString(); } } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs index d62cb6b0fa..7f422848d5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs @@ -649,6 +649,9 @@ namespace Godot /// Access whole columns in the form of . /// /// Which column vector. + /// + /// is not 0, 1, 2 or 3. + /// public Vector4 this[int column] { get @@ -664,7 +667,7 @@ namespace Godot case 3: return w; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(column)); } } set @@ -684,7 +687,7 @@ namespace Godot w = value; return; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(column)); } } } @@ -694,6 +697,9 @@ namespace Godot /// /// Which column vector. /// Which row of the column. + /// + /// or are not 0, 1, 2 or 3. + /// public real_t this[int column, int row] { get @@ -709,7 +715,7 @@ namespace Godot case 3: return w[row]; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(column)); } } set @@ -729,7 +735,7 @@ namespace Godot w[row] = value; return; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(column)); } } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs index 658a14ca1d..39416a34f2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs @@ -47,6 +47,9 @@ namespace Godot /// /// Access quaternion components using their index. /// + /// + /// is not 0, 1, 2 or 3. + /// /// /// [0] is equivalent to , /// [1] is equivalent to , @@ -170,7 +173,7 @@ namespace Godot #if DEBUG if (!IsNormalized()) { - throw new InvalidOperationException("Quaternion is not normalized"); + throw new InvalidOperationException("Quaternion is not normalized."); } #endif var basis = new Basis(this); @@ -186,7 +189,7 @@ namespace Godot #if DEBUG if (!IsNormalized()) { - throw new InvalidOperationException("Quaternion is not normalized"); + throw new InvalidOperationException("Quaternion is not normalized."); } #endif return new Quaternion(-x, -y, -z, w); @@ -224,11 +227,11 @@ namespace Godot #if DEBUG if (!IsNormalized()) { - throw new InvalidOperationException("Quaternion is not normalized"); + throw new InvalidOperationException("Quaternion is not normalized."); } if (!to.IsNormalized()) { - throw new ArgumentException("Argument is not normalized", nameof(to)); + throw new ArgumentException("Argument is not normalized.", nameof(to)); } #endif @@ -388,7 +391,7 @@ namespace Godot #if DEBUG if (!axis.IsNormalized()) { - throw new ArgumentException("Argument is not normalized", nameof(axis)); + throw new ArgumentException("Argument is not normalized.", nameof(axis)); } #endif @@ -444,7 +447,7 @@ namespace Godot #if DEBUG if (!quaternion.IsNormalized()) { - throw new InvalidOperationException("Quaternion is not normalized"); + throw new InvalidOperationException("Quaternion is not normalized."); } #endif var u = new Vector3(quaternion.x, quaternion.y, quaternion.z); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs index 70cf8bbe22..d8acfca33b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs @@ -75,6 +75,9 @@ namespace Godot /// The third column is the vector. /// /// Which column vector. + /// + /// is not 0, 1 or 2. + /// public Vector2 this[int column] { get diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs index 5481225e3f..23e276ef8a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs @@ -32,6 +32,9 @@ namespace Godot /// The fourth column is the vector. /// /// Which column vector. + /// + /// is not 0, 1, 2 or 3. + /// public Vector3 this[int column] { get diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 04c2ea7eb9..efaf56fddf 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -39,8 +39,8 @@ namespace Godot /// /// Access vector components using their index. /// - /// - /// Thrown when the given the is not 0 or 1. + /// + /// is not 0 or 1. /// /// /// [0] is equivalent to , @@ -479,7 +479,7 @@ namespace Godot #if DEBUG if (!normal.IsNormalized()) { - throw new ArgumentException("Argument is not normalized", nameof(normal)); + throw new ArgumentException("Argument is not normalized.", nameof(normal)); } #endif return (2 * Dot(normal) * normal) - this; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs index a8f42972d7..f7eb6f180a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs @@ -39,8 +39,8 @@ namespace Godot /// /// Access vector components using their index. /// - /// - /// Thrown when the given the is not 0 or 1. + /// + /// is not 0 or 1. /// /// /// [0] is equivalent to , diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index d5941d6b60..88f279ccff 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -48,8 +48,8 @@ namespace Godot /// /// Access vector components using their index. /// - /// - /// Thrown when the given the is not 0, 1 or 2. + /// + /// is not 0, 1 or 2. /// /// /// [0] is equivalent to , @@ -497,7 +497,7 @@ namespace Godot #if DEBUG if (!normal.IsNormalized()) { - throw new ArgumentException("Argument is not normalized", nameof(normal)); + throw new ArgumentException("Argument is not normalized.", nameof(normal)); } #endif return (2.0f * Dot(normal) * normal) - this; @@ -515,7 +515,7 @@ namespace Godot #if DEBUG if (!axis.IsNormalized()) { - throw new ArgumentException("Argument is not normalized", nameof(axis)); + throw new ArgumentException("Argument is not normalized.", nameof(axis)); } #endif return new Basis(axis, angle) * this; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs index eb46f36e7c..582956fce8 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs @@ -48,8 +48,8 @@ namespace Godot /// /// Access vector components using their . /// - /// - /// Thrown when the given the is not 0, 1 or 2. + /// + /// is not 0, 1 or 2. /// /// /// [0] is equivalent to , diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs index 20a24616ce..9a99e23d44 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs @@ -57,8 +57,8 @@ namespace Godot /// /// Access vector components using their index. /// - /// - /// Thrown when the given the is not 0, 1, 2 or 3. + /// + /// is not 0, 1, 2 or 3. /// /// /// [0] is equivalent to , @@ -81,7 +81,7 @@ namespace Godot case 3: return w; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(index)); } } set @@ -101,7 +101,7 @@ namespace Godot w = value; return; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(index)); } } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs index 11c2b7234b..d4dbdbec93 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs @@ -57,8 +57,8 @@ namespace Godot /// /// Access vector components using their . /// - /// - /// Thrown when the given the is not 0, 1, 2 or 3. + /// + /// is not 0, 1, 2 or 3. /// /// /// [0] is equivalent to , @@ -81,7 +81,7 @@ namespace Godot case 3: return w; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(index)); } } set @@ -101,7 +101,7 @@ namespace Godot w = value; return; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(index)); } } } -- cgit v1.2.3