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

Make request errors have original error codes. #37

Open
yezen-alnafei opened this issue Dec 1, 2020 · 0 comments
Open

Make request errors have original error codes. #37

yezen-alnafei opened this issue Dec 1, 2020 · 0 comments

Comments

@yezen-alnafei
Copy link

yezen-alnafei commented Dec 1, 2020

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;
  }

Local changes

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant