public ValidationException(List <ValidationFailure> failures) : this() { var propertyNames = failures .Select(e => e.PropertyName) .Distinct(); foreach (var propertyName in propertyNames) { var propertyFailures = failures .Where(e => e.PropertyName == propertyName) .Select(e => e.ErrorMessage) .ToArray(); Failures.Add(propertyName, propertyFailures); } }
/// <summary> /// Attempt each operation. /// Any exceptions from failures are caught and stored for later. /// </summary> /// <param name="actions">The list of actions.</param> /// <returns></returns> public SafeActions Attempt(IEnumerable <Action> actions) { foreach (Action action in actions) { try { action(); } catch (Exception e) { Failures.Add(e); FailureHandler(e); } } return(this); }
public List <Type> GetDynamicTypes() { List <Type> dynamicTypes = new List <Type>(); YamlFiles.Each(new { List = dynamicTypes }, (ctx, yf) => { try { ctx.List.AddRange(yf.DynamicTypes); } catch (Exception ex) { FireEvent(YamlDeserializationFailed, new YamlEventArgs { Schema = this, Files = this.Files, CurrentFile = yf, Exception = ex }); Failures.Add(new YamlDeserializationFailure(yf, ex)); } }); return(dynamicTypes); }
public void Install() { // Record that we have attempted an install. Attempted = true; // Can this be installed at this point? if (CanInstall) { // Possibly need to recreate the installer at this point. Installer = new Installer(Installer.TempInstallFolder, ModuleManifestName(Installer.TempInstallFolder), Globals.ApplicationMapPath, true); // Is the installer valid? if (Installer.IsValid) { // Already installed? if (Installer.InstallerInfo.Installed) { // Yes, make a repair install. Installer.InstallerInfo.RepairInstall = true; } // Install. Installer.Install(); // Did the package install successfully? Success = Installer.IsValid; } // Record failures. foreach (LogEntry log in Installer.InstallerInfo.Log.Logs) { if (log.Type.Equals(LogType.Failure)) { string failure = log.ToString(); Failures.Add(failure); } } } }
public ValidationException(List <ValidationFailure> failures) : this() { var sb = new StringBuilder(); var propertyNames = failures .Select(e => e.PropertyName) .Distinct(); foreach (var propertyName in propertyNames) { var propertyFailures = failures .Where(e => e.PropertyName == propertyName) .Select(e => e.ErrorMessage) .ToArray(); Failures.Add(propertyName, propertyFailures); sb.Append(string.Join(" ", propertyFailures)); } AllFailuresMessage = sb.ToString(); }
private void AddInMatrices(int row, int col, string buildingShort, int buildingIndex) { var temp = _matrixType[row, col].FirstOrDefault(s => s.Contains("@")); bool fail = !(_matrixType[row, col].Count == 0 || (temp != null && temp.Length <= 3)); _matrixType[row, col].Add(buildingShort); _matrixIndex[row, col].Add(buildingIndex); if (fail) { var key = "" + row + "," + col; if (!Failures.ContainsKey(key)) { Failures.Add(key, string.Join("", _matrixType[row, col].ToArray())); } else { Failures[key] += buildingShort; } } }
private R(E error) { IsSuccess = false; Failures.Add(error); }
public ValidationException(List <IdentityError> failures) : this() { Failures.Add("general", failures.Select(x => x.Description).ToArray()); }
public AppSubscriptionException(string failure) : base(failure) { Failures.Add(failure); }
public ValidationException(string key, string[] message) : this() { Failures.Add(key, message); }
public ValidationException(string key, string message) : this() { Failures.Add(key, new string[1] { message }); }
public ValidationException(string propertyName, string errorMessage) : this() { Failures.Add(propertyName, new[] { errorMessage }); }
public BadRequestException(string message) : this() { Failures.Add("message", new string[] { message }); }
public AppBusinessException(string failure) : base(failure) { Failures.Add(failure); }