Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return a Result from Task functions #108

Merged
merged 11 commits into from
Jul 20, 2020

Conversation

jeremyandrews
Copy link
Member

@jeremyandrews jeremyandrews commented Jul 18, 2020

Tasks must be converted to return GooseTaskResult.

This allows the use of ? as it supports returning a GooseTaskError:

pub type GooseTaskResult = Result<(), GooseTaskError>;

Currently we define 3 errors:

/// Definition of all errors Goose Tasks can return.
#[derive(Debug)]
pub enum GooseTaskError {
    /// Contains any possible Reqwest library error.
    Reqwest(reqwest::Error),
    /// The request failed.
    RequestFailed,
    /// The request was canceled (this happens when the throttle is enabled and
    /// the load test finished).
    RequestCanceled,
}

Copy link
Collaborator

@LionsAd LionsAd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks really great - think this is even ready to merge except for little things —

One thing:

I’d leave one example where we explictly call the debug_log — we optimized it away from all examples unless I miss something.

Maybe for a case before sending a request?

tests/redirect.rs Outdated Show resolved Hide resolved
@jeremyandrews jeremyandrews changed the title WIP: return a Result from Task functions return a Result from Task functions Jul 20, 2020
src/goose.rs Outdated Show resolved Hide resolved
@jeremyandrews
Copy link
Member Author

One thing:

I’d leave one example where we explictly call the debug_log — we optimized it away from all examples unless I miss something.

There was a commented out debug println!() in drupal_loadtest, which I converted to a commented out call to log_debug, along with a comment explaining why it's useful (if you're editing the load test).

@jeremyandrews jeremyandrews merged commit 121a979 into tag1consulting:master Jul 20, 2020
@jeremyandrews jeremyandrews deleted the signature branch July 20, 2020 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants