diff options
author | Ben Shteinfeld <ben.shteinfeld@mongodb.com> | 2017-06-07 11:15:23 -0400 |
---|---|---|
committer | Ben Shteinfeld <ben.shteinfeld@mongodb.com> | 2017-08-04 11:01:41 -0400 |
commit | 1599ba40e091bcf356bf0231bf32333397f07753 (patch) | |
tree | 160b6407430fbc3540a9f027e157f9efe35323f8 | |
parent | d88b75291089b0866dde85678447288e58d2d651 (diff) | |
download | mongo-1599ba40e091bcf356bf0231bf32333397f07753.tar.gz |
SERVER-13362 Change BSONElement::chk() to take a BSONType and use uassert
-rw-r--r-- | src/mongo/bson/bsonelement.h | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/databases_cloner.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h index add268f1a1d..003b1ff5763 100644 --- a/src/mongo/bson/bsonelement.h +++ b/src/mongo/bson/bsonelement.h @@ -88,7 +88,7 @@ public: */ using DeferredComparison = BSONComparatorInterfaceBase<BSONElement>::DeferredComparison; - /** These functions, which start with a capital letter, throw a MsgAssertionException if the + /** These functions, which start with a capital letter, throw if the element is not of the required type. Example: std::string foo = obj["foo"].String(); // std::exception if not a std::string type or DNE @@ -690,19 +690,19 @@ private: friend class BSONObjIterator; friend class BSONObj; - const BSONElement& chk(int t) const { + const BSONElement& chk(BSONType t) const { if (t != type()) { StringBuilder ss; if (eoo()) ss << "field not found, expected type " << t; else ss << "wrong type for field (" << fieldName() << ") " << type() << " != " << t; - msgasserted(13111, ss.str()); + uasserted(13111, ss.str()); } return *this; } const BSONElement& chk(bool expr) const { - massert(13118, "unexpected or missing type value in BSON object", expr); + uassert(13118, "unexpected or missing type value in BSON object", expr); return *this; } }; diff --git a/src/mongo/db/repl/databases_cloner.cpp b/src/mongo/db/repl/databases_cloner.cpp index d03f7252c8b..507f39e5d31 100644 --- a/src/mongo/db/repl/databases_cloner.cpp +++ b/src/mongo/db/repl/databases_cloner.cpp @@ -248,7 +248,7 @@ StatusWith<std::vector<BSONElement>> DatabasesCloner::_parseListDatabasesRespons BSONElement response = dbResponse["databases"]; try { return response.Array(); - } catch (const MsgAssertionException& e) { + } catch (const AssertionException& e) { return Status(ErrorCodes::BadValue, "The 'listDatabases' response is unable to be transformed into an array."); } |