From bac92d6f26af84f3492db1fc8d1724155d6245ee Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 14 Apr 2019 21:32:49 -0400 Subject: log underlying error (#636) --- src/SMAPI/Patches/CheckEventPreconditionErrorPatch.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/SMAPI/Patches/CheckEventPreconditionErrorPatch.cs b/src/SMAPI/Patches/CheckEventPreconditionErrorPatch.cs index b62cf41c..673fae1c 100644 --- a/src/SMAPI/Patches/CheckEventPreconditionErrorPatch.cs +++ b/src/SMAPI/Patches/CheckEventPreconditionErrorPatch.cs @@ -70,16 +70,15 @@ namespace StardewModdingAPI.Patches CheckEventPreconditionErrorPatch.IsArbitrated = true; try { - object isValid = CheckEventPreconditionErrorPatch.OriginalMethod.Invoke(__instance, new object[] { precondition }); - __result = isValid is null ? -1 : (int)isValid; + __result = (int)CheckEventPreconditionErrorPatch.OriginalMethod.Invoke(__instance, new object[] { precondition }); + return false; } - catch (System.Exception ex) + catch (TargetInvocationException ex) { __result = -1; - CheckEventPreconditionErrorPatch.MonitorForGame.Log($"Failed parsing event info. Event precondition: {precondition}\n{ex}", LogLevel.Error); + CheckEventPreconditionErrorPatch.MonitorForGame.Log($"Failed parsing event precondition ({precondition}):\n{ex.InnerException}", LogLevel.Error); + return false; } - - return false; } } } -- cgit