internal static bool AbortOnError(Logger log, ActionDef act, Exception err) { act.TryGetValue("onerror", out object onerror); var handle = TrimAndLower(onerror) ?? "log"; if (handle.IndexOf("log") >= 0) { log.Error(err); } else if (handle.IndexOf("err") >= 0) { log.Error(err); } else if (handle.IndexOf("warn") >= 0) { log.Warn(err); } else if (handle.IndexOf("info") >= 0) { log.Info(err); } else if (handle.IndexOf("verbo") >= 0) { log.Verbo(err); } if (handle.IndexOf("stop") >= 0) { log.Info("Aborting because OnError == Stop ({0})", handle); return(true); } return(false); }
private static string GetText(this ActionDef act, string key, string fallback = null) { if (act.TryGetValue(key, out object o) && o is string txt) { return(txt); } return(fallback); }
private static string GetActionField(ActionDef action, ActionDef def, string key) => action.TryGetValue(key, out object val) || def?.TryGetValue(key, out val) == true ? TrimAndLower(val as string) : null;