public override bool Like(SemanticException other)
        {
            bool result = base.Like(other);

            ObjectAlreadyChangedException otherObjectAlreadyChangedException = other as ObjectAlreadyChangedException;

            return(result &&
                   otherObjectAlreadyChangedException != null &&
                   Sender == otherObjectAlreadyChangedException.Sender);
        }
Exemple #2
0
        public override bool Like(SemanticException other)
        {
            bool result = base.Like(other);

            IdNotFoundException <T, TId> otherIdNotFoundException = other as IdNotFoundException <T, TId>;

            return(result &&
                   otherIdNotFoundException != null &&
                   PersistentObjectType == otherIdNotFoundException.PersistentObjectType &&
                   EqualityComparer <TId> .Default.Equals(Id, otherIdNotFoundException.Id));
        }
Exemple #3
0
        public override bool Like(SemanticException other)
        {
            bool result = base.Like(other);

            RepositorySqlException otherRepositorySqlException = other as RepositorySqlException;

            return(result &&
                   otherRepositorySqlException != null &&
                   string.Equals(SqlString, otherRepositorySqlException.SqlString, StringComparison.Ordinal) &&
                   string.Equals(Constraint, otherRepositorySqlException.Constraint, StringComparison.Ordinal));
        }
Exemple #4
0
        protected virtual MessageList BuildMessageList([NotNull] ExceptionContext context, [NotNull] SemanticException se)
        {
            IEnumerable <Message> result = Translate(context, (dynamic)se);

            return(new MessageList {
                Messages = result.ToArray()
            });
        }
Exemple #5
0
 protected virtual HttpStatusCode DetermineHttpStatusCode([NotNull] SemanticException se)
 => HttpStatusCode.BadRequest;
Exemple #6
0
        protected virtual IEnumerable <Message> Translate([NotNull] ExceptionContext context, [NotNull] SemanticException se)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(se.Message);

            if (_environmentsConsideredAsDevelopment.Contains(HostEnvironment.EnvironmentName))
            {
                Exception e = se.InnerException;
                while (e != null)
                {
                    sb.AppendLine(e.Message);
                    e = e.InnerException;
                }
            }

            yield return(BuildMessage(sb.ToString()));
        }