Allow RetryHandler
to stop without throwing
#2996
mikaelkaron
started this conversation in
Ideas
Replies: 2 comments 12 replies
-
Another version of onError (err) {
const { res, callback, body, opaque } = this
removeSignal(this)
if (callback) {
// TODO: Does this need queueMicrotask?
this.callback = null
queueMicrotask(() => {
if (this.throwOnError) {
this.runInAsyncScope(callback, null, err, { opaque })
}
else {
this.runInAsyncScope(callback, null, null, {
...err,
opaque
})
}
})
}
if (res) {
this.res = null
// Ensure all queued handlers are invoked before destroying res.
queueMicrotask(() => {
util.destroy(res, err)
})
}
if (body) {
this.body = null
util.destroy(body, err)
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
My particular use-case is that I'm using a |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment
onHeaders
takesthrowOnError
into account like this:However,
onError
always passes an error:Would it make sense to have
onError
work similar toonHeaders
when callingcallback
:Beta Was this translation helpful? Give feedback.
All reactions