예제 #1
0
        /// <inheritdoc/>
        private void ThrowException(Exception ex)
        {
            var nex = new DBConnectException(ex.Message, ex);
            var tip = nex.InnerException.GetType();

            if (tip.Name == "PostgresException")
            {
                //-- ошибка вызвана PostgreSQL
                nex.errConnectorType = DBInterfaceType.PostgreSQL;
                //-- запрос, вызвавший ошибку
                nex.errSqlText = ((PostgresException)(nex.InnerException)).Statement.SQL;
                //-- индекс ошибки СУБД
                nex.errSqlState = ((PostgresException)(nex.InnerException)).SqlState;
                //-- примерная позиция ошибки
                nex.errSqlPos = ((PostgresException)(nex.InnerException)).Position;
                //-- текст ошибки
                nex.errMessage = ex.Message;
            }
            throw nex;
        }
예제 #2
0
        /// <inheritdoc/>
        private void ThrowException(Exception ex)
        {
            var nex = new DBConnectException(ex.Message, ex);
            var tip = nex.InnerException.GetType();

            if (tip.Name == "SQLiteException")
            {
                //-- ошибка вызвана PostgreSQL
                nex.errConnectorType = DBInterfaceType.SQLite;
                //-- запрос, вызвавший ошибку
                nex.errSqlText = LastSQL;
                //-- индекс ошибки СУБД
                nex.errSqlState = ((SQLiteException)(nex.InnerException)).ErrorCode.ToString();
                //-- примерная позиция ошибки
                //-- в SQLite позиция ошибки не определяется...
                nex.errSqlPos = -1;
                //-- текст ошибки
                nex.errMessage = ex.Message;
            }
            throw nex;
        }