log underlying error (#636)

This commit is contained in:
Jesse Plamondon-Willard 2019-04-14 21:32:49 -04:00
parent 05bfd33ac4
commit bac92d6f26
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 5 additions and 6 deletions

View File

@ -70,17 +70,16 @@ 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;
}
}
}
}
}