diff options
author | Eric Milkie <milkie@10gen.com> | 2012-04-24 11:06:04 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2012-04-24 11:06:04 -0400 |
commit | 6f576584b157e065d0addd43b5d86392f3628b81 (patch) | |
tree | 10d70746abd6f820261adde220e1494624735bcc /src | |
parent | 847a67bf60807b4327b6d0d173c61ed84f522e79 (diff) | |
download | mongo-6f576584b157e065d0addd43b5d86392f3628b81.tar.gz |
rename raiseError to setLastError
This better reflects what this function does. Note that the LastError object
still has a raiseError() function, and that setLastError is just a wrapper
for this internal raiseError().
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/instance.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/lasterror.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/lasterror.h | 4 | ||||
-rw-r--r-- | src/mongo/db/pdfile.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/commands_public.cpp | 3 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 1 | ||||
-rw-r--r-- | src/mongo/util/assert_util.cpp | 12 |
7 files changed, 16 insertions, 13 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 07f2191d465..6009e59b05e 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -413,7 +413,7 @@ namespace mongo { } else if ( ! c.getAuthenticationInfo()->isAuthorized( nsToDatabase( m.singleData()->_data + 4 ) ) ) { - raiseError(0, "unauthorized"); + setLastError(0, "unauthorized"); } else if ( op == dbInsert ) { receivedInsert(m, currentOp); diff --git a/src/mongo/db/lasterror.cpp b/src/mongo/db/lasterror.cpp index 40228f23920..4f232f5436b 100644 --- a/src/mongo/db/lasterror.cpp +++ b/src/mongo/db/lasterror.cpp @@ -28,7 +28,7 @@ namespace mongo { LastErrorHolder lastError; bool isShell = false; - void raiseError(int code , const char *msg) { + void setLastError(int code , const char *msg) { LastError *le = lastError.get(); if ( le == 0 ) { /* might be intentional (non-user thread) */ diff --git a/src/mongo/db/lasterror.h b/src/mongo/db/lasterror.h index 9605bbfcf05..ea60ab629b2 100644 --- a/src/mongo/db/lasterror.h +++ b/src/mongo/db/lasterror.h @@ -17,7 +17,7 @@ #pragma once -#include "../bson/oid.h" +#include "mongo/bson/oid.h" namespace mongo { class BSONObjBuilder; @@ -147,6 +147,6 @@ namespace mongo { }; } lastError; - void raiseError(int code , const char *msg); + void setLastError(int code , const char *msg); } // namespace mongo diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp index 4dd9e98a073..60dc145098b 100644 --- a/src/mongo/db/pdfile.cpp +++ b/src/mongo/db/pdfile.cpp @@ -46,6 +46,7 @@ _ disallow system* manipulations from the database. #include "instance.h" #include "replutil.h" #include "memconcept.h" +#include "mongo/db/lasterror.h" #include <boost/filesystem/operations.hpp> @@ -1894,7 +1895,7 @@ namespace mongo { } verify( le && !saveerrmsg.empty() ); - raiseError(savecode,saveerrmsg.c_str()); + setLastError(savecode,saveerrmsg.c_str()); throw; } } @@ -2059,7 +2060,7 @@ namespace mongo { massert( 12583, "unexpected index insertion failure on capped collection", !d->isCapped() ); string s = e.toString(); s += " : on addIndex/capped - collection and its index will not match"; - raiseError(0, s.c_str()); + setLastError(0, s.c_str()); error() << s << endl; } else { diff --git a/src/mongo/s/commands_public.cpp b/src/mongo/s/commands_public.cpp index 4657508b76a..7b648dca031 100644 --- a/src/mongo/s/commands_public.cpp +++ b/src/mongo/s/commands_public.cpp @@ -29,6 +29,7 @@ #include "s/interrupt_status_mongos.h" #include "../scripting/engine.h" #include "../util/timer.h" +#include "mongo/db/lasterror.h" #include "config.h" @@ -1605,7 +1606,7 @@ namespace mongo { if ( !ok && !have_errmsg) { anObjBuilder.append("errmsg", errmsg); - raiseError(0, errmsg.c_str()); + setLastError(0, errmsg.c_str()); } return true; } diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 1779d9b13ac..d5f343bed56 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -42,6 +42,7 @@ #include "../util/processinfo.h" #include "mongo/util/util.h" #include "mongo/util/concurrency/remap_lock.h" +#include "mongo/db/lasterror.h" #if defined(_WIN32) # include "../util/ntservice.h" diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp index 51493811eac..c940614e9e3 100644 --- a/src/mongo/util/assert_util.cpp +++ b/src/mongo/util/assert_util.cpp @@ -25,6 +25,7 @@ using namespace std; #endif #include "mongo/bson/bsonobjbuilder.h" +#include "mongo/db/lasterror.h" #include "mongo/util/util.h" namespace mongo { @@ -74,7 +75,6 @@ namespace mongo { } string getDbContext(); - void raiseError(int code , const char *msg); /* "warning" assert -- safe to continue, so we don't throw exception. */ NOINLINE_DECL void wasserted(const char *msg, const char *file, unsigned line) { @@ -93,7 +93,7 @@ namespace mongo { problem() << "warning assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; sayDbContext(); - raiseError(0,msg && *msg ? msg : "wassertion failure"); + setLastError(0,msg && *msg ? msg : "wassertion failure"); assertionCount.condrollover( ++assertionCount.warning ); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF) // this is so we notice in buildbot @@ -106,7 +106,7 @@ namespace mongo { assertionCount.condrollover( ++assertionCount.regular ); problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; sayDbContext(); - raiseError(0,msg && *msg ? msg : "assertion failure"); + setLastError(0,msg && *msg ? msg : "assertion failure"); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(),0); @@ -137,7 +137,7 @@ namespace mongo { NOINLINE_DECL void uasserted(int msgid, const char *msg) { assertionCount.condrollover( ++assertionCount.user ); LOG(1) << "User Assertion: " << msgid << ":" << msg << endl; - raiseError(msgid,msg); + setLastError(msgid,msg); throw UserException(msgid, msg); } @@ -148,7 +148,7 @@ namespace mongo { NOINLINE_DECL void msgasserted(int msgid, const char *msg) { assertionCount.condrollover( ++assertionCount.warning ); tlog() << "Assertion: " << msgid << ":" << msg << endl; - raiseError(msgid,msg && *msg ? msg : "massert failure"); + setLastError(msgid,msg && *msg ? msg : "massert failure"); //breakpoint(); printStackTrace(); throw MsgAssertionException(msgid, msg); @@ -157,7 +157,7 @@ namespace mongo { NOINLINE_DECL void msgassertedNoTrace(int msgid, const char *msg) { assertionCount.condrollover( ++assertionCount.warning ); log() << "Assertion: " << msgid << ":" << msg << endl; - raiseError(msgid,msg && *msg ? msg : "massert failure"); + setLastError(msgid,msg && *msg ? msg : "massert failure"); throw MsgAssertionException(msgid, msg); } |