-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] Add an Error Handling section to the Authentication page #98
Conversation
✅ Deploy Preview for docs-cpp ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
2c1b254
to
5a4866c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ 1 change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor feedback; otherwise, LGTM.
source/includes/authentication.cpp
Outdated
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?" | ||
"authSource=admin&authMechanism=SCRAM-SHA-256"); | ||
auto client = mongocxx::client(uri); | ||
client["db"].run_command(bsoncxx::from_json(R"({"ping": 1})")); // Any command requiring authorization | ||
} catch (const mongocxx::exception& ex) { | ||
std::cerr << "Error: " << ex.what() << std::endl; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try { | |
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?" | |
"authSource=admin&authMechanism=SCRAM-SHA-256"); | |
auto client = mongocxx::client(uri); | |
client["db"].run_command(bsoncxx::from_json(R"({"ping": 1})")); // Any command requiring authorization | |
} catch (const mongocxx::exception& ex) { | |
std::cerr << "Error: " << ex.what() << std::endl; | |
} | |
auto uri = mongocxx::uri("mongodb://<db_username>:<db_password>@<hostname>:<port>/?" | |
"authSource=admin&authMechanism=SCRAM-SHA-256"); | |
auto client = mongocxx::client(uri); | |
try { | |
// Any command requiring authorization | |
client["db"].run_command(bsoncxx::from_json(R"({"ping": 1})")); | |
} catch (const mongocxx::exception& ex) { | |
std::cerr << "Error: " << ex.what() << std::endl; | |
} |
Consider minimizing the scope of code within the try-catch statement to that which is expected to throw the relevant exception.
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-NNNNN
Slack conversation with C++ team
Staging Links
Self-Review Checklist