/// <summary> /// Links to exists return values, where one is caused by another /// </summary> /// <param name="orignal"></param> /// <param name="handler"></param> public static ReturnValue ErrorHandlerFail(ReturnValue orignal, ReturnValue handler, string context ="") { handler.Inner = orignal; var fail = FailResult(string.Format("Error handler cascade failure: {0}",context)); fail.Inner = handler; return fail; }
public static void AssertResult(ReturnValue result) { if (!result.Success) { Assert.Fail(result.ToString()); } }
protected bool ShowStatus(ReturnValue result, string context) { if (!result.Success) { MessageBox.Show(result.ToString(), context, MessageBoxButtons.OK, MessageBoxIcon.Error); ShowStatus(string.Format("{0} failed.", context), Color.Red); Debug.WriteLine(result); } ShowStatus(string.Format("{0} complete.", context)); return result.Success; }
public AbortException(ReturnValue caller) : this() { Caller = caller; }
public static void Abort(ReturnValue getResult) { throw new AbortException(getResult); }
/// <summary> /// creates an error chain and returns failure. /// </summary> /// <param name="inner">ReturnValue containing error information that is the cause of this failure</param> /// <returns></returns> public static ReturnValue Cascade(ReturnValue inner, string context = "") { var fail = FailResult(string.IsNullOrEmpty(context) ? "Cascade failure" : context); fail.Inner = inner; return fail; }
private void AddResult(string imageKey, string key, string schema, string desc, ReturnValue<TableDiff> tdiffResult ) { var groupKey = imageKey; if (imageKey == "dataschemadiff") groupKey = "datadiff"; var li = new ListViewItem(new[] {key, schema, desc}, imageKey, Groups[groupKey]) { Tag = tdiffResult }; if (li.Group.Name != "error" && li.Group.Name != "equal") { li.Checked = true; } Items.Add(li); }