-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
The problem
Request errors e.g. ETIMEDOUT don't have status or error code, would be nice to have so we can use them to open a circuit breaker or log out.
Suggested solution
Make transport.js add error code in createError()
createError(err, ctx) {
const error = new Error(`Request failed for ${ctx.req.getMethod()} ${ctx.req.getUrl()}: ${err.message}`);
error.code = err.code;
return error;
}
Alternatives considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
We need to make timeout errors open our circuit breaker, as currently, we only open when we get 100+ 5xx errors. We do get the timeout error, but only as error object, with no error or status code which makes it hard to identify them, would be nice for request errors (e.g. timeout errors) to have error codes to identify them.