summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/gridfs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/gridfs.cpp b/client/gridfs.cpp
index 233724ae8e5..b1ab2d5d550 100644
--- a/client/gridfs.cpp
+++ b/client/gridfs.cpp
@@ -130,6 +130,12 @@ namespace mongo {
}
BSONObj GridFS::insertFile(const string& name, const OID& id, gridfs_offset length, const string& contentType) {
+ // Wait for any pending writebacks to finish
+ string err = _client.getLastError();
+ uassert( 16428,
+ str::stream() << "Error storing GridFS chunk for file: " << name
+ << ", error: " << err,
+ err == "" );
BSONObj res;
if ( ! _client.runCommand( _dbName.c_str() , BSON( "filemd5" << id << "root" << _prefix ) , res ) )