diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-08-10 15:52:33 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-08-16 16:28:02 -0400 |
commit | 347935f7a5d0452146b1a73ad7ef9e249eaf1fb5 (patch) | |
tree | 00b322f5adcf3eb9c2624747a6b5b2179e440052 /src/mongo/db/commands | |
parent | cdf7aacb213c99d3ce620761ff46b030bbd7732d (diff) | |
download | mongo-347935f7a5d0452146b1a73ad7ef9e249eaf1fb5.tar.gz |
SERVER-30580 Eliminate UserException and MsgAssertionException types
All users were converted to just use AssertionException.
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/eval.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/getmore_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/mr_test.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/commands/parameters.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 2 |
5 files changed, 13 insertions, 12 deletions
diff --git a/src/mongo/db/commands/eval.cpp b/src/mongo/db/commands/eval.cpp index b4860f561e4..9abc1a285f2 100644 --- a/src/mongo/db/commands/eval.cpp +++ b/src/mongo/db/commands/eval.cpp @@ -207,7 +207,7 @@ public: OldClientContext ctx(opCtx, dbname, false /* no shard version checking here */); return dbEval(opCtx, dbname, cmdObj, result, errmsg); - } catch (const UserException& ex) { + } catch (const AssertionException& ex) { // Convert a stale shardVersion error to a stronger error to prevent this node or the // sending node from believing it needs to refresh its routing table. if (ex.code() == ErrorCodes::RecvStaleConfig) { diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 1ad1878ba29..d3b2ca63078 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -451,7 +451,7 @@ public: // FAILURE state will make getMore command close the cursor even if it's tailable. *state = PlanExecutor::FAILURE; return Status::OK(); - } catch (const UserException& except) { + } catch (const AssertionException& except) { if (isAwaitData && except.code() == ErrorCodes::ExceededTimeLimit) { // We ignore exceptions from interrupt points due to max time expiry for // awaitData cursors. diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp index 406feab7487..a3f8d95bf54 100644 --- a/src/mongo/db/commands/mr_test.cpp +++ b/src/mongo/db/commands/mr_test.cpp @@ -115,23 +115,24 @@ void _testConfigParseOutputOptions(const std::string& dbname, */ TEST(ConfigOutputOptionsTest, parseOutputOptions) { // Missing 'out' field. - ASSERT_THROWS(mr::Config::parseOutputOptions("mydb", fromjson("{}")), UserException); + ASSERT_THROWS(mr::Config::parseOutputOptions("mydb", fromjson("{}")), AssertionException); // 'out' must be either string or object. - ASSERT_THROWS(mr::Config::parseOutputOptions("mydb", fromjson("{out: 99}")), UserException); + ASSERT_THROWS(mr::Config::parseOutputOptions("mydb", fromjson("{out: 99}")), + AssertionException); // 'out.nonAtomic' is not supported with normal, replace or inline. ASSERT_THROWS(mr::Config::parseOutputOptions( "mydb", fromjson("{out: {normal: 'mycoll', nonAtomic: true}}")), - UserException); + AssertionException); ASSERT_THROWS(mr::Config::parseOutputOptions( "mydb", fromjson("{out: {replace: 'mycoll', nonAtomic: true}}")), - UserException); + AssertionException); ASSERT_THROWS(mr::Config::parseOutputOptions( "mydb", fromjson("{out: {inline: 'mycoll', nonAtomic: true}}")), - UserException); + AssertionException); // Unknown output specifer. ASSERT_THROWS( mr::Config::parseOutputOptions("mydb", fromjson("{out: {no_such_out_type: 'mycoll'}}")), - UserException); + AssertionException); // 'out' is string. @@ -251,7 +252,7 @@ TEST(ConfigTest, CollationNotAnObjectFailsToParse) { bob.append("out", "outCollection"); bob.append("collation", "en_US"); BSONObj cmdObj = bob.obj(); - ASSERT_THROWS(mr::Config(dbname, cmdObj), UserException); + ASSERT_THROWS(mr::Config(dbname, cmdObj), AssertionException); } } // namespace diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp index 2c0164fdae9..f75a440bb77 100644 --- a/src/mongo/db/commands/parameters.cpp +++ b/src/mongo/db/commands/parameters.cpp @@ -459,7 +459,7 @@ public: virtual Status set(const BSONElement& newValueElement) { try { return setFromString(newValueElement.String()); - } catch (const MsgAssertionException& msg) { + } catch (const AssertionException& msg) { return Status(ErrorCodes::BadValue, mongoutils::str::stream() << "Invalid value for sslMode via setParameter command: " @@ -530,7 +530,7 @@ public: virtual Status set(const BSONElement& newValueElement) { try { return setFromString(newValueElement.String()); - } catch (const MsgAssertionException& msg) { + } catch (const AssertionException& msg) { return Status(ErrorCodes::BadValue, mongoutils::str::stream() << "Invalid value for clusterAuthMode via setParameter command: " diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 90789bd51c1..d6cedeb95d3 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -174,7 +174,7 @@ public: while (_validationsInProgress.find(nss.ns()) != _validationsInProgress.end()) { opCtx->waitForConditionOrInterrupt(_validationNotifier, lock); } - } catch (UserException& e) { + } catch (AssertionException& e) { appendCommandStatus( result, {ErrorCodes::CommandFailed, |