diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-12-28 17:12:49 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-12-28 17:12:49 -0500 |
commit | d5a5401f9ae5aacaf41cb34e70c8e9eecf1b2fb9 (patch) | |
tree | 77d74a2eddf3e8fef092b6899af393dd5667fece /db/lasterror.h | |
parent | fa8961c3e8804a2fd606160d7649e973e906d0b4 (diff) | |
download | mongo-d5a5401f9ae5aacaf41cb34e70c8e9eecf1b2fb9.tar.gz |
use code in getLastError SERVER-112
Diffstat (limited to 'db/lasterror.h')
-rw-r--r-- | db/lasterror.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/db/lasterror.h b/db/lasterror.h index 08709335b67..ae9781d9e88 100644 --- a/db/lasterror.h +++ b/db/lasterror.h @@ -26,6 +26,7 @@ namespace mongo { class Message; struct LastError { + int code; string msg; enum UpdatedExistingType { NotUpdate, True, False } updatedExisting; /* todo: nObjects should be 64 bit */ @@ -33,8 +34,9 @@ namespace mongo { int nPrev; bool valid; bool overridenById; - void raiseError(const char *_msg) { + void raiseError(int _code , const char *_msg) { reset( true ); + code = _code; msg = _msg; } void recordUpdate( bool _updatedExisting, int nChanged ) { @@ -51,6 +53,7 @@ namespace mongo { reset(); } void reset( bool _valid = false ) { + code = 0; msg.clear(); updatedExisting = NotUpdate; nObjects = 0; @@ -93,13 +96,13 @@ namespace mongo { map<int,Status> _ids; } lastError; - inline void raiseError(const char *msg) { + inline void raiseError(int code , const char *msg) { LastError *le = lastError.get(); if ( le == 0 ) { DEV log() << "warning: lastError==0 can't report:" << msg << '\n'; return; } - le->raiseError(msg); + le->raiseError(code, msg); } inline void recordUpdate( bool updatedExisting, int nChanged ) { |