improve error message for TargetParameterCountException in the reflection API
This commit is contained in:
parent
18a5b07c5b
commit
d662ea858c
|
@ -11,6 +11,7 @@
|
||||||
* For modders:
|
* For modders:
|
||||||
* Added asset propagation for grass textures.
|
* Added asset propagation for grass textures.
|
||||||
* Added asset propagation for `Data\Bundles` changes (for added bundles only).
|
* Added asset propagation for `Data\Bundles` changes (for added bundles only).
|
||||||
|
* Improved error messages for `TargetParameterCountException` when using the reflection API.
|
||||||
* `helper.Read/WriteSaveData` can now be used while a save is being loaded (e.g. within a `Specialized.LoadStageChanged` event).
|
* `helper.Read/WriteSaveData` can now be used while a save is being loaded (e.g. within a `Specialized.LoadStageChanged` event).
|
||||||
* Fixed private textures loaded from content packs not having their `Name` field set.
|
* Fixed private textures loaded from content packs not having their `Name` field set.
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ namespace StardewModdingAPI.Framework.Reflection
|
||||||
{
|
{
|
||||||
result = this.MethodInfo.Invoke(this.Parent, arguments);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new Exception($"Couldn't invoke the {this.DisplayName} method", ex);
|
throw new Exception($"Couldn't invoke the {this.DisplayName} method", ex);
|
||||||
|
|
Loading…
Reference in New Issue