summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-08-01 15:15:29 -0400
committerMathias Stearn <mathias@10gen.com>2017-08-16 16:28:02 -0400
commitcdf7aacb213c99d3ce620761ff46b030bbd7732d (patch)
treecdc32bf8c2899f88b2b3ea99c89e76bbc314f4ab /src/mongo
parent5a1b0681dcee481f631dc647000b895e20cc7cfd (diff)
downloadmongo-cdf7aacb213c99d3ce620761ff46b030bbd7732d.tar.gz
SERVER-30580 Make argument order consistently code then message
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/status_test.cpp2
-rw-r--r--src/mongo/client/dbclient_rs.cpp6
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.cpp2
-rw-r--r--src/mongo/db/keys_collection_manager_sharding.cpp6
-rw-r--r--src/mongo/db/pipeline/close_change_stream_exception.h2
-rw-r--r--src/mongo/db/repl/apply_ops.cpp4
-rw-r--r--src/mongo/db/repl/master_slave.h2
-rw-r--r--src/mongo/logger/redaction_test.cpp4
-rw-r--r--src/mongo/s/client/parallel.cpp2
-rw-r--r--src/mongo/s/stale_exception.h10
-rw-r--r--src/mongo/shell/bench.cpp18
-rw-r--r--src/mongo/util/assert_util.cpp2
-rw-r--r--src/mongo/util/assert_util.h11
-rw-r--r--src/mongo/util/net/cidr.cpp8
-rw-r--r--src/mongo/util/net/cidr.h2
-rw-r--r--src/mongo/util/net/socket_exception.cpp2
-rw-r--r--src/mongo/util/options_parser/option_description.cpp28
-rw-r--r--src/mongo/util/options_parser/option_section.cpp8
18 files changed, 58 insertions, 61 deletions
diff --git a/src/mongo/base/status_test.cpp b/src/mongo/base/status_test.cpp
index a8840135624..a8896c046b1 100644
--- a/src/mongo/base/status_test.cpp
+++ b/src/mongo/base/status_test.cpp
@@ -209,7 +209,7 @@ TEST(Transformers, ExceptionToStatus) {
Status fromDBExcept = [=]() {
try {
- throw DBException(reason, ErrorCodes::TypeMismatch);
+ throw DBException(ErrorCodes::TypeMismatch, reason);
} catch (...) {
return exceptionToStatus();
}
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index f3316a1d373..2803536e397 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -651,9 +651,9 @@ unique_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult(
BSONElement code = error["code"];
if (code.isNumber() && code.Int() == ErrorCodes::NotMasterOrSecondary) {
isntSecondary();
- throw DBException(str::stream() << "slave " << _lastSlaveOkHost.toString()
- << " is no longer secondary",
- 14812);
+ throw DBException(14812,
+ str::stream() << "slave " << _lastSlaveOkHost.toString()
+ << " is no longer secondary");
}
return result;
diff --git a/src/mongo/db/concurrency/write_conflict_exception.cpp b/src/mongo/db/concurrency/write_conflict_exception.cpp
index 2ef2e2a3494..b2eb893088f 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.cpp
+++ b/src/mongo/db/concurrency/write_conflict_exception.cpp
@@ -40,7 +40,7 @@ namespace mongo {
AtomicBool WriteConflictException::trace(false);
WriteConflictException::WriteConflictException()
- : DBException("WriteConflict", ErrorCodes::WriteConflict) {
+ : DBException(ErrorCodes::WriteConflict, "WriteConflict") {
if (trace.load()) {
printStackTrace();
}
diff --git a/src/mongo/db/keys_collection_manager_sharding.cpp b/src/mongo/db/keys_collection_manager_sharding.cpp
index c43779cbcbe..42a4aaa961a 100644
--- a/src/mongo/db/keys_collection_manager_sharding.cpp
+++ b/src/mongo/db/keys_collection_manager_sharding.cpp
@@ -186,8 +186,8 @@ void KeysCollectionManagerSharding::PeriodicRunner::refreshNow(OperationContext*
stdx::lock_guard<stdx::mutex> lk(_mutex);
if (_inShutdown) {
- throw DBException("aborting keys cache refresh because node is shutting down",
- ErrorCodes::ShutdownInProgress);
+ throw DBException(ErrorCodes::ShutdownInProgress,
+ "aborting keys cache refresh because node is shutting down");
}
if (_refreshRequest) {
@@ -203,7 +203,7 @@ void KeysCollectionManagerSharding::PeriodicRunner::refreshNow(OperationContext*
// waitFor also throws if timeout, so also throw when notification was not satisfied after
// waiting.
if (!refreshRequest->waitFor(opCtx, kDefaultRefreshWaitTime)) {
- throw DBException("timed out waiting for refresh", ErrorCodes::ExceededTimeLimit);
+ throw DBException(ErrorCodes::ExceededTimeLimit, "timed out waiting for refresh");
}
}
diff --git a/src/mongo/db/pipeline/close_change_stream_exception.h b/src/mongo/db/pipeline/close_change_stream_exception.h
index 862d9bbf67a..782255e2f92 100644
--- a/src/mongo/db/pipeline/close_change_stream_exception.h
+++ b/src/mongo/db/pipeline/close_change_stream_exception.h
@@ -40,7 +40,7 @@ namespace mongo {
class CloseChangeStreamException : public DBException {
public:
CloseChangeStreamException()
- : DBException("CloseChangeStream", ErrorCodes::CloseChangeStream) {}
+ : DBException(ErrorCodes::CloseChangeStream, "CloseChangeStream") {}
};
} // namespace mongo
diff --git a/src/mongo/db/repl/apply_ops.cpp b/src/mongo/db/repl/apply_ops.cpp
index f153a60ade6..c4d05d660fd 100644
--- a/src/mongo/db/repl/apply_ops.cpp
+++ b/src/mongo/db/repl/apply_ops.cpp
@@ -139,9 +139,9 @@ Status _applyOps(OperationContext* opCtx,
if (!dbHolder().get(opCtx, ns)) {
throw DBException(
+ ErrorCodes::NamespaceNotFound,
"cannot create a database in atomic applyOps mode; will retry without "
- "atomicity",
- ErrorCodes::NamespaceNotFound);
+ "atomicity");
}
OldClientContext ctx(opCtx, ns);
diff --git a/src/mongo/db/repl/master_slave.h b/src/mongo/db/repl/master_slave.h
index 627223efd16..e404a3fb0ec 100644
--- a/src/mongo/db/repl/master_slave.h
+++ b/src/mongo/db/repl/master_slave.h
@@ -61,7 +61,7 @@ extern const char* replInfo;
/* A replication exception */
class SyncException : public DBException {
public:
- SyncException() : DBException("sync exception", 10001) {}
+ SyncException() : DBException(10001, "sync exception") {}
};
/* A Source is a source from which we can pull (replicate) data.
diff --git a/src/mongo/logger/redaction_test.cpp b/src/mongo/logger/redaction_test.cpp
index 2e300199458..e1f12d6c4ab 100644
--- a/src/mongo/logger/redaction_test.cpp
+++ b/src/mongo/logger/redaction_test.cpp
@@ -53,13 +53,13 @@ TEST(RedactStatusTest, StatusOK) {
TEST(RedactExceptionTest, NoRedact) {
logger::globalLogDomain()->setShouldRedactLogs(false);
- DBException ex(kMsg, ErrorCodes::InternalError);
+ DBException ex(ErrorCodes::InternalError, kMsg);
ASSERT_EQ(redact(ex), ex.toString());
}
TEST(RedactExceptionTest, BasicException) {
logger::globalLogDomain()->setShouldRedactLogs(true);
- DBException ex(kMsg, ErrorCodes::InternalError);
+ DBException ex(ErrorCodes::InternalError, kMsg);
ASSERT_EQ(redact(ex), "InternalError ###");
}
diff --git a/src/mongo/s/client/parallel.cpp b/src/mongo/s/client/parallel.cpp
index 0341cacaf5d..a7ddaefbe54 100644
--- a/src/mongo/s/client/parallel.cpp
+++ b/src/mongo/s/client/parallel.cpp
@@ -1160,7 +1160,7 @@ void ParallelSortClusteredCursor::_oldInit() {
throw RecvStaleConfigException(
_ns, errMsg.str(), ChunkVersion(0, 0, OID()), ChunkVersion(0, 0, OID()));
} else if (throwException) {
- throw DBException(errMsg.str(), 14827);
+ throw DBException(14827, errMsg.str());
} else {
warning() << redact(errMsg.str());
}
diff --git a/src/mongo/s/stale_exception.h b/src/mongo/s/stale_exception.h
index 5268da4c5ef..1661320db8e 100644
--- a/src/mongo/s/stale_exception.h
+++ b/src/mongo/s/stale_exception.h
@@ -46,13 +46,13 @@ public:
ChunkVersion received,
ChunkVersion wanted)
: AssertionException(
+ code,
str::stream() << raw << " ( ns : " << ns << ", received : " << received.toString()
<< ", wanted : "
<< wanted.toString()
<< ", "
<< (code == ErrorCodes::SendStaleConfig ? "send" : "recv")
- << " )",
- code),
+ << " )"),
_ns(ns),
_received(received),
_wanted(wanted) {}
@@ -60,6 +60,7 @@ public:
/** Preferred if we're rebuilding this from a thrown exception */
StaleConfigException(const std::string& raw, int code, const BSONObj& error)
: AssertionException(
+ code,
str::stream() << raw << " ( ns : " << (error["ns"].type() == String
? error["ns"].String()
: std::string("<unknown>"))
@@ -69,8 +70,7 @@ public:
<< ChunkVersion::fromBSON(error, "vWanted").toString()
<< ", "
<< (code == ErrorCodes::SendStaleConfig ? "send" : "recv")
- << " )",
- code),
+ << " )"),
// For legacy reasons, we may not always get a namespace here
_ns(error["ns"].type() == String ? error["ns"].String() : ""),
_received(ChunkVersion::fromBSON(error, "vReceived")),
@@ -81,7 +81,7 @@ public:
* stale config exceptions in a map and this requires a default constructor.
*/
StaleConfigException()
- : AssertionException("initializing empty stale config exception object", 0) {}
+ : AssertionException(0, "initializing empty stale config exception object") {}
virtual ~StaleConfigException() throw() {}
diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp
index 0c1ad2eb943..e0ef5b9ba3a 100644
--- a/src/mongo/shell/bench.cpp
+++ b/src/mongo/shell/bench.cpp
@@ -954,9 +954,9 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
if (!result["err"].eoo() && result["err"].type() == String &&
(_config->throwGLE || op.throwGLE))
- throw DBException((string) "From benchRun GLE" +
- causedBy(result["err"].String()),
- result["code"].eoo() ? 0 : result["code"].Int());
+ throw DBException(result["code"].eoo() ? 0 : result["code"].Int(),
+ (string) "From benchRun GLE" +
+ causedBy(result["err"].String()));
}
} break;
case OpType::INSERT: {
@@ -1023,9 +1023,9 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
if (!result["err"].eoo() && result["err"].type() == String &&
(_config->throwGLE || op.throwGLE))
- throw DBException((string) "From benchRun GLE" +
- causedBy(result["err"].String()),
- result["code"].eoo() ? 0 : result["code"].Int());
+ throw DBException(result["code"].eoo() ? 0 : result["code"].Int(),
+ (string) "From benchRun GLE" +
+ causedBy(result["err"].String()));
}
} break;
case OpType::REMOVE: {
@@ -1072,9 +1072,9 @@ void BenchRunWorker::generateLoadOnConnection(DBClientBase* conn) {
if (!result["err"].eoo() && result["err"].type() == String &&
(_config->throwGLE || op.throwGLE))
- throw DBException((string) "From benchRun GLE " +
- causedBy(result["err"].String()),
- result["code"].eoo() ? 0 : result["code"].Int());
+ throw DBException(result["code"].eoo() ? 0 : result["code"].Int(),
+ (string) "From benchRun GLE " +
+ causedBy(result["err"].String()));
}
} break;
case OpType::CREATEINDEX:
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index 8dd4c1cde5b..05f2d9943d8 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -113,7 +113,7 @@ NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned lin
logContext();
stringstream temp;
temp << "assertion " << file << ":" << line;
- AssertionException e(temp.str(), 0);
+ AssertionException e(0, temp.str());
breakpoint();
#if defined(MONGO_CONFIG_DEBUG_BUILD)
// this is so we notice in buildbot
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h
index 34ebc8eb2af..feebe646eec 100644
--- a/src/mongo/util/assert_util.h
+++ b/src/mongo/util/assert_util.h
@@ -69,9 +69,7 @@ public:
invariant(!status.isOK());
traceIfNeeded(*this);
}
- DBException(const char* msg, int code)
- : DBException(Status(code ? ErrorCodes::fromInt(code) : ErrorCodes::UnknownError, msg)) {}
- DBException(const std::string& msg, int code)
+ DBException(int code, const std::string& msg)
: DBException(Status(code ? ErrorCodes::fromInt(code) : ErrorCodes::UnknownError, msg)) {}
virtual ~DBException() throw() {}
@@ -116,8 +114,7 @@ protected:
class AssertionException : public DBException {
public:
AssertionException(const Status& status) : DBException(status) {}
- AssertionException(const char* msg, int code) : DBException(msg, code) {}
- AssertionException(const std::string& msg, int code) : DBException(msg, code) {}
+ AssertionException(int code, const std::string& msg) : DBException(code, msg) {}
virtual ~AssertionException() throw() {}
@@ -132,7 +129,7 @@ public:
/* UserExceptions are valid errors that a user can cause, like out of disk space or duplicate key */
class UserException : public AssertionException {
public:
- UserException(int c, const std::string& m) : AssertionException(m, c) {}
+ UserException(int c, const std::string& m) : AssertionException(c, m) {}
virtual bool severe() const {
return false;
}
@@ -145,7 +142,7 @@ public:
class MsgAssertionException : public AssertionException {
public:
MsgAssertionException(const Status& status) : AssertionException(status) {}
- MsgAssertionException(int c, const std::string& m) : AssertionException(m, c) {}
+ MsgAssertionException(int c, const std::string& m) : AssertionException(c, m) {}
virtual bool severe() const {
return false;
}
diff --git a/src/mongo/util/net/cidr.cpp b/src/mongo/util/net/cidr.cpp
index 91eca7b7422..d8fe660eb23 100644
--- a/src/mongo/util/net/cidr.cpp
+++ b/src/mongo/util/net/cidr.cpp
@@ -111,7 +111,7 @@ CIDR::CIDR(StringData s) try {
_family = AF_INET6;
_len = kIPv6Bits;
} else {
- throw CIDRException("Invalid IP address in CIDR string", ErrorCodes::BadValue);
+ throw CIDRException("Invalid IP address in CIDR string");
}
if (slash == end(s)) {
@@ -120,14 +120,14 @@ CIDR::CIDR(StringData s) try {
auto len = strict_stoi(std::string(slash + 1, end(s)), 10);
if ((len < 0) || (len > _len)) {
- throw CIDRException("Invalid length in CIDR string", ErrorCodes::BadValue);
+ throw CIDRException("Invalid length in CIDR string");
}
_len = len;
} catch (const std::invalid_argument& e) {
- throw CIDRException("Non-numeric length in CIDR string", ErrorCodes::BadValue);
+ throw CIDRException("Non-numeric length in CIDR string");
} catch (const std::out_of_range& e) {
- throw CIDRException("Invalid length in CIDR string", ErrorCodes::BadValue);
+ throw CIDRException("Invalid length in CIDR string");
}
template <>
diff --git a/src/mongo/util/net/cidr.h b/src/mongo/util/net/cidr.h
index 4b21f307931..bd10d32dbc1 100644
--- a/src/mongo/util/net/cidr.h
+++ b/src/mongo/util/net/cidr.h
@@ -44,7 +44,7 @@ namespace mongo {
class CIDRException : public DBException {
public:
- CIDRException(const StringData& w, int code) : DBException(w.toString(), code) {}
+ CIDRException(const StringData& w) : DBException(ErrorCodes::BadValue, w.toString()) {}
};
/**
diff --git a/src/mongo/util/net/socket_exception.cpp b/src/mongo/util/net/socket_exception.cpp
index b5899454584..88b75fd1873 100644
--- a/src/mongo/util/net/socket_exception.cpp
+++ b/src/mongo/util/net/socket_exception.cpp
@@ -63,7 +63,7 @@ SocketException::SocketException(Type t,
const std::string& server,
int code,
const std::string& extra)
- : DBException(std::string("socket exception [") + getStringType(t) + "] for " + server, code),
+ : DBException(code, std::string("socket exception [") + getStringType(t) + "] for " + server),
_type(t),
_server(server),
_extra(extra) {}
diff --git a/src/mongo/util/options_parser/option_description.cpp b/src/mongo/util/options_parser/option_description.cpp
index d2c1fd9f1f0..857b359b6b7 100644
--- a/src/mongo/util/options_parser/option_description.cpp
+++ b/src/mongo/util/options_parser/option_description.cpp
@@ -128,14 +128,14 @@ OptionDescription::OptionDescription(const std::string& dottedName,
if (std::count(_deprecatedDottedNames.begin(), _deprecatedDottedNames.end(), "")) {
StringBuilder sb;
sb << "Attempted to register option with empty string for deprecated dotted name";
- throw DBException(sb.str(), ErrorCodes::BadValue);
+ throw DBException(ErrorCodes::BadValue, sb.str());
}
// Should not be the same as _dottedName.
if (std::count(_deprecatedDottedNames.begin(), _deprecatedDottedNames.end(), dottedName)) {
StringBuilder sb;
sb << "Attempted to register option with conflict between dottedName and deprecated "
<< "dotted name: " << _dottedName;
- throw DBException(sb.str(), ErrorCodes::BadValue);
+ throw DBException(ErrorCodes::BadValue, sb.str());
}
}
@@ -151,7 +151,7 @@ OptionDescription& OptionDescription::setDefault(Value defaultValue) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "Cannot register a default value for a composing option";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Make sure the type of our default value matches our declared type
@@ -160,7 +160,7 @@ OptionDescription& OptionDescription::setDefault(Value defaultValue) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "mismatch between declared type and type of default value: " << ret.toString();
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
_default = defaultValue;
@@ -174,7 +174,7 @@ OptionDescription& OptionDescription::setImplicit(Value implicitValue) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "Cannot register an implicit value for a composing option";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Make sure the type of our implicit value matches our declared type
@@ -183,7 +183,7 @@ OptionDescription& OptionDescription::setImplicit(Value implicitValue) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "mismatch between declared type and type of implicit value: " << ret.toString();
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// It doesn't make sense to set an "implicit value" for switch options since they can never
@@ -192,7 +192,7 @@ OptionDescription& OptionDescription::setImplicit(Value implicitValue) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "the implicit value of a Switch option is true and cannot be changed";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
_implicit = implicitValue;
@@ -204,7 +204,7 @@ OptionDescription& OptionDescription::composing() {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "only options registered as StringVector or StringMap can be composing";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Disallow registering a default value for a composing option since the interaction
@@ -213,7 +213,7 @@ OptionDescription& OptionDescription::composing() {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "Cannot make an option with an default value composing";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Disallow registering an implicit value for a composing option since the interaction
@@ -222,7 +222,7 @@ OptionDescription& OptionDescription::composing() {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "Cannot make an option with an implicit value composing";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
_isComposing = true;
@@ -239,7 +239,7 @@ OptionDescription& OptionDescription::positional(int start, int end) {
StringBuilder sb;
sb << "Could not register option \"" << _dottedName << "\": "
<< "Invalid positional specification: \"start\": " << start << ", \"end\": " << end;
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
if ((end - start) > 0) {
@@ -248,7 +248,7 @@ OptionDescription& OptionDescription::positional(int start, int end) {
sb << "Could not register option \"" << _dottedName << "\": "
<< "Positional range implies that multiple values are allowed, "
<< "but option is not registered as type StringVector";
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
}
@@ -269,7 +269,7 @@ OptionDescription& OptionDescription::validRange(long min, long max) {
sb << "Could not register option \"" << _dottedName << "\": "
<< "only options registered as a numeric type can have a valid range, "
<< "but option has type: " << _type;
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
return addConstraint(new NumericKeyConstraint(_dottedName, min, max));
@@ -290,7 +290,7 @@ OptionDescription& OptionDescription::format(const std::string& regexFormat,
sb << "Could not register option \"" << _dottedName << "\": "
<< "only options registered as a string type can have a required format, "
<< "but option has type: " << _type;
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
return addConstraint(new StringFormatKeyConstraint(_dottedName, regexFormat, displayFormat));
diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp
index 904bf5e284f..4bdbb1e28c1 100644
--- a/src/mongo/util/options_parser/option_section.cpp
+++ b/src/mongo/util/options_parser/option_section.cpp
@@ -90,14 +90,14 @@ OptionDescription& OptionSection::addOptionChaining(
if (option._dottedName == oditerator->_dottedName) {
StringBuilder sb;
sb << "Attempted to register option with duplicate dottedName: " << option._dottedName;
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Allow options with empty singleName since some options are not allowed on the command
// line
if (!option._singleName.empty() && option._singleName == oditerator->_singleName) {
StringBuilder sb;
sb << "Attempted to register option with duplicate singleName: " << option._singleName;
- throw DBException(sb.str(), ErrorCodes::InternalError);
+ throw DBException(ErrorCodes::InternalError, sb.str());
}
// Deprecated dotted names should not conflict with dotted names or deprecated dotted
// names of any other options.
@@ -107,7 +107,7 @@ OptionDescription& OptionSection::addOptionChaining(
StringBuilder sb;
sb << "Attempted to register option with duplicate deprecated dotted name "
<< "(with another option's dotted name): " << option._dottedName;
- throw DBException(sb.str(), ErrorCodes::BadValue);
+ throw DBException(ErrorCodes::BadValue, sb.str());
}
for (std::vector<std::string>::const_iterator i =
oditerator->_deprecatedDottedNames.begin();
@@ -119,7 +119,7 @@ OptionDescription& OptionSection::addOptionChaining(
StringBuilder sb;
sb << "Attempted to register option with duplicate deprecated dotted name " << *i
<< " (other option " << oditerator->_dottedName << ")";
- throw DBException(sb.str(), ErrorCodes::BadValue);
+ throw DBException(ErrorCodes::BadValue, sb.str());
}
}
}