tag1consulting / goose

Load testing framework, inspired by Locust
https://tag1.com/goose
Apache License 2.0
759 stars 69 forks source link

Correct error handling in transactions #544

Closed AlexXi19 closed 1 year ago

AlexXi19 commented 1 year ago

I'm defining custom operations in the transactions that does not use the user request methods and would like to return errors without unwrapping them. What's the best way to do this? Should I try to find a way to construct a TransactionError and return it?

jeremyandrews commented 1 year ago

Please see the discussion in https://github.com/tag1consulting/goose/issues/250#issuecomment-1137099406 which may be relevant -- although, I think you're saying in your case you don't have a GooseUser object, so you can't call https://docs.rs/goose/latest/goose/goose/struct.GooseUser.html#method.set_failure, is that correct?

In that case, you likely should mimic what we're doing here: https://github.com/tag1consulting/goose/blob/24eae0ef4dc23bf1681bda092b6ef52b164aec00/src/goose.rs#L1932

AlexXi19 commented 1 year ago

Thanks Jeremy!