Skip to content

Commit 6f60474

Browse files
committed
README: display clear errors in the example
1 parent 577c504 commit 6f60474

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,18 @@ async fn main() {
9393
}.into_query("weather"),
9494
);
9595

96-
let write_result = client
97-
.query(weather_readings)
98-
.await;
99-
assert!(write_result.is_ok(), "Write result was not okay");
96+
if let Err(e) = client.query(weather_readings).await {
97+
println!("Error writing result: {e}");
98+
return;
99+
}
100100

101101
// Let's see if the data we wrote is there
102102
let read_query = ReadQuery::new("SELECT * FROM weather");
103103

104-
let read_result = client.query(read_query).await;
105-
assert!(read_result.is_ok(), "Read result was not ok");
106-
println!("{}", read_result.unwrap());
104+
match client.query(read_query).await {
105+
Ok(read_result) => println!("{}", read_result),
106+
Err(e) => println!("Error reading result: {e}"),
107+
}
107108
}
108109
```
109110

0 commit comments

Comments
 (0)