예제 #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 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);
        }
예제 #3
0
파일: Error.cs 프로젝트: hasaki/ragetanks
        public Error(StructureMapException exception)
        {
            _code    = exception.ErrorCode;
            _message = exception.Message;

            writeStackTrace(exception);
        }
        public void ExceptionMessage()
        {
            var exception = new StructureMapException(100, "StructureMap.config");
            string expected =
                "StructureMap Exception Code:  100\nExpected file \"StructureMap.config\" cannot be opened at StructureMap.config";

            string actual = exception.Message;

            Assert.AreEqual(expected, actual);
        }
        public void ExceptionMessage()
        {
            var    exception = new StructureMapException(100, "StructureMap.config");
            string expected  =
                "StructureMap Exception Code:  100\nExpected file \"StructureMap.config\" cannot be opened at StructureMap.config";

            string actual = exception.Message;

            Assert.AreEqual(expected, actual);
        }
        public void CanSerialize()
        {
            var ex = new ApplicationException("Oh no!");
            var smapEx = new StructureMapException(200, ex, "a", "b");

            var formatter = new BinaryFormatter();
            var stream = new MemoryStream();
            formatter.Serialize(stream, smapEx);

            stream.Position = 0;

            var smapEx2 = (StructureMapException) formatter.Deserialize(stream);
            Assert.AreNotSame(smapEx, smapEx2);

            Assert.AreEqual(smapEx.Message, smapEx2.Message);
        }
        public void CanSerialize()
        {
            var ex     = new ApplicationException("Oh no!");
            var smapEx = new StructureMapException(200, ex, "a", "b");

            var formatter = new BinaryFormatter();
            var stream    = new MemoryStream();

            formatter.Serialize(stream, smapEx);

            stream.Position = 0;

            var smapEx2 = (StructureMapException)formatter.Deserialize(stream);

            Assert.AreNotSame(smapEx, smapEx2);

            Assert.AreEqual(smapEx.Message, smapEx2.Message);
        }
예제 #8
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);
            }
        }
예제 #9
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);
            }
        }
        public void SetUp()
        {
            good = Expression.Constant("I am good");

            genericEx    = new NotImplementedException();
            throwGeneral = Expression.Block(Expression.Throw(Expression.Constant(genericEx)),
                                            Expression.Constant("bar"));

            smEx    = new StructureMapException("you stink!");
            throwSM = Expression.Block(Expression.Throw(Expression.Constant(smEx)),
                                       Expression.Constant("bar"));

            var gateway = new StubbedGateway();

            Expression <Action> goodExpr = () => gateway.DoSomething();

            goodVoid  = Expression.Block(goodExpr.Body);
            badVoid   = Expression.Block(Expression.Throw(Expression.Constant(genericEx)));
            badSmVoid = Expression.Block(Expression.Throw(Expression.Constant(smEx)));
        }
예제 #11
0
        public void SetUp()
        {
            good = Expression.Constant("I am good");

            genericEx = new NotImplementedException();
            throwGeneral = Expression.Block(Expression.Throw(Expression.Constant(genericEx)),
                Expression.Constant("bar"));

            smEx = new StructureMapException("you stink!");
            throwSM = Expression.Block(Expression.Throw(Expression.Constant(smEx)),
                Expression.Constant("bar"));

            var gateway = new StubbedGateway();

            Expression<Action> goodExpr = () => gateway.DoSomething();

            goodVoid = Expression.Block(goodExpr.Body);
            badVoid = Expression.Block(Expression.Throw(Expression.Constant(genericEx)));
            badSmVoid = Expression.Block(Expression.Throw(Expression.Constant(smEx)));
        }
예제 #12
0
 public void RegisterError(StructureMapException ex)
 {
     var error = new Error(ex);
     addError(error);
 }
예제 #13
0
        public void RegisterError(StructureMapException ex)
        {
            var error = new Error(ex);

            addError(error);
        }