Skip to content

Commit 4ccd448

Browse files
authored
RUST-396 Parse responses with command errors into Errors in run_command (#174)
1 parent 1cda935 commit 4ccd448

File tree

4 files changed

+2
-46
lines changed

4 files changed

+2
-46
lines changed

src/client/executor.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,7 @@ impl Client {
181181
session.advance_cluster_time(cluster_time)
182182
}
183183
}
184-
185-
if !op.handles_command_errors() {
186-
response.validate().map(|_| response)
187-
} else {
188-
Ok(response)
189-
}
184+
response.validate().map(|_| response)
190185
}
191186
err => err,
192187
};

src/operation/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ pub(crate) trait Operation {
6262
None
6363
}
6464

65-
/// Whether or not the operation has special handling for command errors, or whether they should
66-
/// just be propogated to the user immediately.
67-
fn handles_command_errors(&self) -> bool {
68-
false
69-
}
70-
7165
/// Whether or not this operation will request acknowledgment from the server.
7266
fn is_acknowledged(&self) -> bool {
7367
self.write_concern()

src/operation/run_command/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ impl Operation for RunCommand {
6969
Ok(response.raw_response)
7070
}
7171

72-
fn handles_command_errors(&self) -> bool {
73-
true
74-
}
75-
7672
fn selection_criteria(&self) -> Option<&SelectionCriteria> {
7773
self.selection_criteria.as_ref()
7874
}

src/test/client.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ async fn scram_missing_user_options() {
467467

468468
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
469469
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
470-
async fn saslprep_options() {
470+
async fn saslprep() {
471471
let client = TestClient::new().await;
472472

473473
if client.server_version_lt(4, 0) || !client.auth_enabled() {
@@ -497,35 +497,6 @@ async fn saslprep_options() {
497497
auth_test_options("IX", "I\u{00AD}X", None, true).await;
498498
auth_test_options("\u{2168}", "IV", None, true).await;
499499
auth_test_options("\u{2168}", "I\u{00AD}V", None, true).await;
500-
}
501-
502-
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
503-
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
504-
async fn saslprep_uri() {
505-
let client = TestClient::new().await;
506-
507-
if client.server_version_lt(4, 0) || !client.auth_enabled() {
508-
return;
509-
}
510-
511-
client
512-
.create_user(
513-
"IX",
514-
"IX",
515-
&[Bson::from("root")],
516-
&[AuthMechanism::ScramSha256],
517-
)
518-
.await
519-
.unwrap();
520-
client
521-
.create_user(
522-
"\u{2168}",
523-
"\u{2163}",
524-
&[Bson::from("root")],
525-
&[AuthMechanism::ScramSha256],
526-
)
527-
.await
528-
.unwrap();
529500

530501
auth_test_uri("IX", "IX", None, true).await;
531502
auth_test_uri("IX", "I%C2%ADX", None, true).await;

0 commit comments

Comments
 (0)