protected override void OnRequestSent()
        {
            var dbName = SimoHelper.GetDatabaseName(FullCollectionName);
            var cmd = new GetLastErrorCommand(Connection) { DatabaseName = dbName };
            cmd.Execute();

            if (cmd.Response.IsEmpty)
                return;

            var errMsg = MongoDbErrorMessage.FromDocument(cmd.Response.Documents[0]);
            if (errMsg == null)
                return;

            throw new SimoCommandException(ExceptionMessages.DatabaseCommand_CommandWasNotOk, errMsg);
        }
예제 #2
0
        protected override void OnRequestSent()
        {
            var dbName = SimoHelper.GetDatabaseName(FullCollectionName);
            var cmd    = new GetLastErrorCommand(Connection)
            {
                DatabaseName = dbName
            };

            cmd.Execute();

            if (cmd.Response.IsEmpty)
            {
                return;
            }

            var errMsg = MongoDbErrorMessage.FromDocument(cmd.Response.Documents[0]);

            if (errMsg == null)
            {
                return;
            }

            throw new SimoCommandException(ExceptionMessages.DatabaseCommand_CommandWasNotOk, errMsg);
        }
        protected override void OnRequestSent()
        {
            // TODO: this is not necessary, optionally with writeConcern/ fireAndForget tactic
            var dbName = SimoHelper.GetDatabaseName(FullCollectionName);
            var cmd = new GetLastErrorCommand(Connection, (NumReconnections) => { }) { DatabaseName = dbName };
            cmd.Execute();

            if (cmd.Response.IsEmpty)
                return;

            var errMsg = MongoDbErrorMessage.FromDocument(cmd.Response.Documents[0]);
            if (errMsg == null)
                return;

            throw new SimoCommandException(ExceptionMessages.DatabaseCommand_CommandWasNotOk, errMsg);
        }