got: Timeout callback instead of an error
What problem are you trying to solve?
We have an SLA with external party which defines that they are to provide a response within 1 second timeframe. If there is no response, we have to interrupt the request and assume the default value. We do not consider that to be an error that needs to be handled but just one possible flow.
Describe the feature
Expose additional field callback
on Timeout options object. If specified, no timeout error will be thrown, instead, a callback is invoked with original request
, as well as same event
and timings
that TimeoutError has.
Checklist
- I have read the documentation and made sure this feature doesn’t already exist.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (3 by maintainers)
It’s created, just not thrown.
Alternatively, maybe we could add a
beforeTimeout
hook, but there’s has to be some good reasons whybeforeError
wouldn’t work.