Skip to content

Commit

Permalink
feat: allow transaction functions returning "any error" as string.
Browse files Browse the repository at this point in the history
In some cases, the transaction function cannot return any of the other
errors variants easily. In such a case, having a "custom" (other) error
type seems fine.
  • Loading branch information
ctron committed Sep 3, 2024
1 parent 1a8280e commit 6702672
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/goose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ pub enum TransactionError {
Reqwest(reqwest::Error),
/// Wraps a [`url::ParseError`](https://docs.rs/url/*/url/enum.ParseError.html).
Url(url::ParseError),
/// A generic, custom error in cases where the [`TransactionFunction`] cannot turn any of the others.
Custom(String),
/// The request failed.
RequestFailed {
/// The [`GooseRequestMetric`](./struct.GooseRequestMetric.html) that failed.
Expand Down Expand Up @@ -377,6 +379,7 @@ impl TransactionError {
match *self {
TransactionError::Reqwest(_) => "reqwest::Error",
TransactionError::Url(_) => "url::ParseError",
TransactionError::Custom(_) => "custom error",
TransactionError::RequestFailed { .. } => "request failed",
TransactionError::RequestCanceled { .. } => {
"request canceled because throttled load test ended"
Expand Down

0 comments on commit 6702672

Please sign in to comment.