fix error-handling when patch is called with a null target method (#711)
This commit is contained in:
parent
518bf7e3f1
commit
c5c30189e4
|
@ -34,6 +34,7 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
// get patch types
|
||||||
var patchTypes = new List<string>();
|
var patchTypes = new List<string>();
|
||||||
if (prefix != null)
|
if (prefix != null)
|
||||||
patchTypes.Add("prefix");
|
patchTypes.Add("prefix");
|
||||||
|
@ -42,7 +43,12 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
|
||||||
if (transpiler != null)
|
if (transpiler != null)
|
||||||
patchTypes.Add("transpiler");
|
patchTypes.Add("transpiler");
|
||||||
|
|
||||||
throw new Exception($"Harmony instance {this.Id} failed applying {string.Join("/", patchTypes)} to method {original.DeclaringType?.FullName}.{original.Name}.", ex);
|
// get original method label
|
||||||
|
string methodLabel = original != null
|
||||||
|
? $"method {original.DeclaringType?.FullName}.{original.Name}"
|
||||||
|
: "null method";
|
||||||
|
|
||||||
|
throw new Exception($"Harmony instance {this.Id} failed applying {string.Join("/", patchTypes)} to {methodLabel}.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue