diff options
Diffstat (limited to 'client/model.cpp')
-rw-r--r-- | client/model.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/model.cpp b/client/model.cpp index 2068024445a..abf9b587015 100644 --- a/client/model.cpp +++ b/client/model.cpp @@ -36,7 +36,7 @@ namespace mongo { return true; } - void Model::save(){ + void Model::save( bool check ){ ScopedDbConnection conn( modelServer() ); BSONObjBuilder b; @@ -67,8 +67,15 @@ namespace mongo { conn->update( getNS() , q , o ); } + + string errmsg = ""; + if ( check ) + errmsg = conn->getLastError(); conn.done(); + + if ( check && errmsg.size() ) + throw UserException( (string)"error on Model::save: " + errmsg ); } } // namespace mongo |