diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-05-22 13:28:55 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-05-22 15:30:58 -0400 |
commit | 5ef166f8cb4820ff76943339f9df4e1f80e956b3 (patch) | |
tree | b6bae10ed261e68618870d75542fd8a4ab8ee4dc /src/mongo/s/mongos_options.cpp | |
parent | bc45142fd9a2739484fa586ff7263318e63059b8 (diff) | |
download | mongo-5ef166f8cb4820ff76943339f9df4e1f80e956b3.tar.gz |
SERVER-18567 Replace legacy ConnectionString::parse in MongoS startup
Diffstat (limited to 'src/mongo/s/mongos_options.cpp')
-rw-r--r-- | src/mongo/s/mongos_options.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp index 9b5e52d33af..26e4d8f5fcf 100644 --- a/src/mongo/s/mongos_options.cpp +++ b/src/mongo/s/mongos_options.cpp @@ -37,6 +37,7 @@ #include <vector> #include "mongo/base/status.h" +#include "mongo/base/status_with.h" #include "mongo/bson/util/builder.h" #include "mongo/config.h" #include "mongo/db/server_options.h" @@ -255,18 +256,17 @@ namespace mongo { return Status(ErrorCodes::BadValue, "error: no args for --configdb"); } - std::string configdbString = params["sharding.configDB"].as<std::string>(); - try { - std::string errmsg; - mongosGlobalParams.configdbs = ConnectionString::parse(configdbString, errmsg); + { + std::string configdbString = params["sharding.configDB"].as<std::string>(); - if (!mongosGlobalParams.configdbs.isValid()) { + auto configdbConnectionString = ConnectionString::parse(configdbString); + if (!configdbConnectionString.isOK()) { return Status(ErrorCodes::BadValue, - str::stream() << "Invalid configdb connection string: " << errmsg); + str::stream() << "Invalid configdb connection string: " + << configdbConnectionString.getStatus().toString()); } - } catch (const DBException& e) { - return Status(ErrorCodes::BadValue, - str::stream() << "Invalid configdb connection string: " << e.what()); + + mongosGlobalParams.configdbs = configdbConnectionString.getValue(); } std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers(); |