示例#1
0
        public bool TryTransform(Exception original, out Exception transformed)
        {
            if (original is NpgsqlException e)
            {
                var knownCause = KnownNotSupportedExceptionCause.KnownCauses.FirstOrDefault(x => x.Matches(e));
                if (knownCause != null)
                {
                    var command = e.ReadNpgsqlCommand();

                    transformed = new MartenCommandNotSupportedException(knownCause.Reason, command, e, knownCause.Description);

                    return(true);
                }
            }

            transformed = null;
            return(false);
        }
        internal static bool TryToMapToMartenCommandNotSupportedException
        (
            NpgsqlCommand command,
            Exception innerException,
            out MartenCommandNotSupportedException notSupportedException
        )
        {
            var knownCause = KnownNotSupportedExceptionCause.KnownCauses.FirstOrDefault(x => x.Matches(innerException));

            if (knownCause != null)
            {
                notSupportedException = new MartenCommandNotSupportedException(knownCause.Reason, command, innerException, knownCause.Description);

                return(true);
            }

            notSupportedException = null;
            return(false);
        }