summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-15 00:33:08 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-15 00:33:08 -0500
commitd662ea858c4914eefe5a0b0f911d1f41086b0424 (patch)
tree8fef340e4fcf587a42213b21e2db9f641ecd72a4 /src/SMAPI/Framework
parent18a5b07c5ba277e4ea424228a9148e498e0361fa (diff)
downloadSMAPI-d662ea858c4914eefe5a0b0f911d1f41086b0424.tar.gz
SMAPI-d662ea858c4914eefe5a0b0f911d1f41086b0424.tar.bz2
SMAPI-d662ea858c4914eefe5a0b0f911d1f41086b0424.zip
improve error message for TargetParameterCountException in the reflection API
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/Reflection/ReflectedMethod.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Reflection/ReflectedMethod.cs b/src/SMAPI/Framework/Reflection/ReflectedMethod.cs
index 039f27c3..82737a7f 100644
--- a/src/SMAPI/Framework/Reflection/ReflectedMethod.cs
+++ b/src/SMAPI/Framework/Reflection/ReflectedMethod.cs
@@ -65,6 +65,10 @@ namespace StardewModdingAPI.Framework.Reflection
{
result = this.MethodInfo.Invoke(this.Parent, arguments);
}
+ catch (TargetParameterCountException)
+ {
+ throw new Exception($"Couldn't invoke the {this.DisplayName} method: it expects {this.MethodInfo.GetParameters().Length} parameters, but {arguments.Length} were provided.");
+ }
catch (Exception ex)
{
throw new Exception($"Couldn't invoke the {this.DisplayName} method", ex);