예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }