Skip to content

Commit 1a17e3d

Browse files
committed
CXX-832 Friendlier error message when decoding Decimal128 BSONElements
1 parent 50ce454 commit 1a17e3d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mongo/bson/bsonelement.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@ int BSONElement::size(int maxLen) const {
500500
x = (int)(len1 + 1 + len2 + 1);
501501
} break;
502502
default: {
503+
massert(0,
504+
"This version of the MongoDB C++ driver does not support the Decimal128 BSON "
505+
"type. Please look for a newer version of the driver that supports it.",
506+
type() != 19);
503507
StringBuilder ss;
504508
ss << "BSONElement: bad type " << (int)type();
505509
std::string msg = ss.str();
@@ -563,6 +567,10 @@ int BSONElement::size() const {
563567
x = (int)(len1 + 1 + len2 + 1);
564568
} break;
565569
default: {
570+
massert(0,
571+
"This version of the MongoDB C++ driver does not support the Decimal128 BSON "
572+
"type. Please look for a newer version of the driver that supports it.",
573+
type() != 19);
566574
StringBuilder ss;
567575
ss << "BSONElement: bad type " << (int)type();
568576
std::string msg = ss.str();

0 commit comments

Comments
 (0)