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

add more setup/invocation options: onError (function), captureResults (integer) #2

Merged
merged 1 commit into from Jul 25, 2016

Conversation

saadtazi
Copy link
Owner

See Proposal in #1 . Interface has changed a little bit: available options:

{
  // new options...
  // the last 10 results will be stored and will be available in `onError`... You can use `Infinity` if needed
  captureResults: 10,
  // error handler. errorType is `retries` or `duration`
  onError({ errorType, reject, nbAttempts, startedAt, capturedResults }, options) {
    //... return error(s)...
    const err = new Error('....');
    // attach properties to error if you want, for example...
    err.capturedResults = capturedResults;
    reject(err);
  }
  // also available...
  // default Promise A+ library (defaults: native Promise)
  Promise: Bluebird,
  // default number of retries before rejecting - default: Infinity
  retries: 10,
  // time to wait between 2 calls - default: 0
  wait: 5,
  // max number of milliseconds before rejecting - default: Infinity
  duration: 25
}

Those options can be used when invoking setup() but also until(func, testfunc, options).

@saadtazi saadtazi force-pushed the feature/onError-handler-and-captured-results branch 2 times, most recently from 6963a78 to 12f8dfc Compare July 23, 2016 04:56
@saadtazi saadtazi force-pushed the feature/onError-handler-and-captured-results branch from 12f8dfc to 819d4f0 Compare July 23, 2016 05:01
@coveralls
Copy link

coveralls commented Jul 23, 2016

Coverage Status

Coverage increased (+2.8%) to 100.0% when pulling 819d4f0 on feature/onError-handler-and-captured-results into 0f89442 on master.

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.

None yet

2 participants