summaryrefslogtreecommitdiff
path: root/src/mongo/idl
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2020-02-20 17:01:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-21 16:38:50 +0000
commit7d5a7b2afe99c12ff8260835bb6d80cbdc0ef48d (patch)
treeb05f3a241ee5f1133ea173e3e45cf0102b31d065 /src/mongo/idl
parent428ac6507118e58b6709e3dbae9fb4657e377637 (diff)
downloadmongo-7d5a7b2afe99c12ff8260835bb6d80cbdc0ef48d.tar.gz
SERVER-46071 Handle nan/inf/out-of-range inputs to integral set parameter values
Diffstat (limited to 'src/mongo/idl')
-rw-r--r--src/mongo/idl/server_parameter_with_storage.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/idl/server_parameter_with_storage.h b/src/mongo/idl/server_parameter_with_storage.h
index 480983f4ad2..1871aa6156a 100644
--- a/src/mongo/idl/server_parameter_with_storage.h
+++ b/src/mongo/idl/server_parameter_with_storage.h
@@ -248,8 +248,9 @@ public:
Status set(const BSONElement& newValueElement) final {
element_type newValue;
- if (!newValueElement.coerce(&newValue)) {
- return Status(ErrorCodes::BadValue, "Can't coerce value");
+ if (auto status = newValueElement.tryCoerce(&newValue); !status.isOK()) {
+ return {status.code(),
+ str::stream() << "Failed setting " << name() << ": " << status.reason()};
}
return setValue(newValue);