catch error when parsing front page
@@ -81,9 +81,9 @@ fn drupal_loadtest_front_page(client: &mut GooseClient) {
match response {
Ok(r) => {
// Grab all src values from image tags.
- Document::from_read(r)
- .unwrap()
- .find(Name("img"))
+ match Document::from_read(r) {
+ Ok(d) => {
+ d.find(Name("img"))
.filter_map(|n| n.attr("src"))
.for_each(|x| {
// @TODO: once we're done comparing Goose to Locust, improve this
@@ -94,7 +94,12 @@ fn drupal_loadtest_front_page(client: &mut GooseClient) {
});
},
Err(e) => {
- eprintln!("unexpected error when loading / page: {}", e);
+ eprintln!("failed to parse front page: {}", e);
+ }
+ }
+ },
+ Err(e) => {
+ eprintln!("unexpected error when loading front page: {}", e);
client.set_failure();
},
}
