public void LogError( Instance instance, Type pluginType, StructureMapException ex, IEnumerable <BuildDependency> dependencies) { if (_buildErrors.ContainsKey(instance)) { BuildError existingError = _buildErrors[instance]; addDependenciesToError(instance, dependencies, existingError); } if (_brokenInstances.Contains(instance)) { return; } InstanceToken token = ((IDiagnosticInstance)instance).CreateToken(); var error = new BuildError(pluginType, instance); error.Exception = ex; _buildErrors.Add(instance, error); addDependenciesToError(instance, dependencies, error); }
public BuildError Find(Type pluginType, string name) { foreach (var pair in _buildErrors) { BuildError error = pair.Value; if (error.PluginType == pluginType && error.Instance.Name == name) { return(error); } } return(null); }
private void addDependenciesToError(Instance instance, IEnumerable <BuildDependency> dependencies, BuildError error) { foreach (BuildDependency dependency in dependencies) { if (_brokenInstances.Contains(instance)) { continue; } error.AddDependency(dependency); _brokenInstances.Add(dependency.Instance); } }
public void AddError(Type pluginType, Instance instance, StructureMapException ex) { var rootCause = ex.Instances.First(); var rootProblem = _errors.FirstOrDefault(x => x.RootInstance == rootCause); if (rootProblem != null) { rootProblem.AddDependency(new BuildDependency(pluginType, instance)); } else { var error = new BuildError(pluginType, instance) { Exception = ex }; _errors.Add(error); } }