Ejemplo n.º 1
0
 /// <summary>Log an error and warn the user.</summary>
 /// <param name="monitor">Encapsulates monitoring and logging.</param>
 /// <param name="ex">The exception to handle.</param>
 /// <param name="verb">The verb describing where the error occurred (e.g. "looking that up"). This is displayed on the screen, so it should be simple and avoid characters that might not be available in the sprite font.</param>
 /// <param name="detailedVerb">A more detailed form of <see cref="verb"/> if applicable. This is displayed in the log, so it can be more technical and isn't constrained by the sprite font.</param>
 public static void InterceptError(this IMonitor monitor, Exception ex, string verb, string detailedVerb = null)
 {
     detailedVerb = detailedVerb ?? verb;
     monitor.Log($"Something went wrong {detailedVerb}:\n{ex}", LogLevel.Error);
     ModHelper.ShowErrorMessage($"Huh. Something went wrong {verb}. The error log has the technical details.");
 }
Ejemplo n.º 2
0
 public static void HandleError(IMod mod, Exception ex, string verb)
 {
     mod.Monitor.Log($"Something went wrong {verb}:\n{ex}", LogLevel.Error);
     ModHelper.ShowErrorMessage($"Huh. Something went wrong {verb}. The error log has the technical details.");
 }