diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2017-10-10 14:45:31 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2017-10-11 09:47:56 -0400 |
commit | b1d1b244c73a726c0c6708cf1cb196079f570414 (patch) | |
tree | 111fd7efe4dfa7ff8816604198e60dd323ae0f4d /src/mongo/db/matcher/expression_parser.h | |
parent | fc249a3d97370dcaa4a6fd8c58f116bfca71283f (diff) | |
download | mongo-b1d1b244c73a726c0c6708cf1cb196079f570414.tar.gz |
SERVER-31496 MatchExpressionParser::parse() should not throw
Diffstat (limited to 'src/mongo/db/matcher/expression_parser.h')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h index 6091d3f1426..76f1e19c863 100644 --- a/src/mongo/db/matcher/expression_parser.h +++ b/src/mongo/db/matcher/expression_parser.h @@ -129,8 +129,12 @@ public: const ExtensionsCallback& extensionsCallback = ExtensionsCallbackNoop(), AllowedFeatureSet allowedFeatures = kDefaultSpecialFeatures) { invariant(expCtx.get()); - return MatchExpressionParser(&extensionsCallback) - ._parse(obj, expCtx, allowedFeatures, DocumentParseLevel::kPredicateTopLevel); + try { + return MatchExpressionParser(&extensionsCallback) + ._parse(obj, expCtx, allowedFeatures, DocumentParseLevel::kPredicateTopLevel); + } catch (const DBException& ex) { + return {ex.toStatus()}; + } } /** |