public static DialogResult Show(this ILogger logger, PatchingProcessException outerException)
        {
            Exception exception = outerException.InnerException ?? outerException;

            string targetFile      = outerException.TargetFile;
            string instructionName = outerException.AssociatedInstruction?.Name;

            string failedObjects = string.Empty;

            if (targetFile != null)
            {
                if (instructionName == null)
                {
                    failedObjects = targetFile;
                }
                else
                {
                    failedObjects = string.Format("{0} -> {1}", instructionName, targetFile);
                }
            }

            var exceptionMessage = new PatchingExceptionMessage
            {
                Exception     = exception,
                FailedObjects = failedObjects,
                Hint          = outerException.GetHint(),
                Message       = exception.Message,
                Operation     = outerException.Step.GetEnumValueText() ?? "Patch a file",
            };

            logger.Error(exceptionMessage.ToString());

            return(logger.Show(exceptionMessage));
        }
Example #2
0
        private void Command_Display_Patching_Error(PatchingProcessException ex)
        {
            var targetFile        = ex.TargetFile;
            var thePatch          = ex.AssociatedInstruction?.Name;
            var objectsThatFailed = "";

            if (targetFile != null && thePatch != null)
            {
                objectsThatFailed = $"{thePatch} ⇒ {targetFile}";
            }
            else if (targetFile != null)
            {
                objectsThatFailed = targetFile;
            }
            var tryingToDoWhat = ex.Step.GetEnumValueText() ?? "Patch a file";

            Command_Display_Error(tryingToDoWhat, objectsThatFailed, ex.InnerException);
        }
Example #3
0
		private void Command_Display_Patching_Error(PatchingProcessException ex) {
			var targetFile = ex.TargetFile;
			var thePatch = ex.AssociatedInstruction?.Name;
			var objectsThatFailed = "";
			if (targetFile != null && thePatch != null) {
				objectsThatFailed = $"{thePatch} ⇒ {targetFile}";
			} else if (targetFile != null) {
				objectsThatFailed = targetFile;
			}
			var tryingToDoWhat = ex.Step.GetEnumValueText() ?? "Patch a file";
			Command_Display_Error(tryingToDoWhat, objectsThatFailed, ex.InnerException);
		}