attempt icon indicating copy to clipboard operation
attempt copied to clipboard

Unclear documentation for handleError

Open timtucker-dte opened this issue 3 years ago • 1 comments

For handleError, it's unclear from the documentation what will happen if you throw an error from within the handleError method.

Is the following enough to abort execution automatically? handleError(context) => { throw new Error("Stop Processing!"); }

Or would we need to add in an extra call to context.abort?: handleError(context) => { context.abort(); throw new Error("Stop Processing!"); }

timtucker-dte avatar Oct 13 '22 23:10 timtucker-dte

Similarly, for timeout it could be a little clearer at what point ATTEMPT_TIMEOUT will be thrown.

In the example shown where a time out of 1000ms is shown, if the function that's being wrapped takes 2000ms, at what point is the ATTEMPT_TIMEOUT error thrown?

Is it thrown at 1000ms (when the timeout expires)?

Is it thrown at 2000ms regardless of whether or not the function resolves to a completed status?

Or is it thrown at 2000ms only if the inner function throws an error or has a rejected promise?

timtucker-dte avatar Oct 14 '22 17:10 timtucker-dte