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

Report network errors meaningfully #7733

Open
medikoo opened this issue May 15, 2020 · 2 comments
Open

Report network errors meaningfully #7733

medikoo opened this issue May 15, 2020 · 2 comments

Comments

@medikoo
Copy link
Contributor

medikoo commented May 15, 2020

Use case description

When users are facing network issues, they're reported with noisy ECONNRESET errors or similar, shown with a full stack trace.

This looks like a bug in our application, when it isn't (it's either issue with user connection or a temporary problem with the external service they're trying to access).

It'll be nice to output a clear message signaling the network issue.

Proposed solution

In logError logic detect if we deal with network error and show a meaningful error message.

Detection should recognize errors by error codes (list of codes)

Network error should be reported with a message as follows:

{original error message (no stack trace)}

It's either problem with your internet connection or temporary unavailability of external service.

If your internet connection is stable and given problem repeats for a longer period please report the problem an issue tracker of remote service you're relying on 

Related issues: #7732, #7572, #7596, #8225

@chrisVillanueva
Copy link

Greetings @medikoo

To address this issue, do you think we should start with something like this:

const userErrorNames = new Set(['ServerlessError', 'YAMLException']);
const networkErrorNames = new Set(['ETIMEDOUT','ECONNRESET','EADDRINUSE','ECONNREFUSED','EPIPE','ENOTFOUND','ENETUNREACH','EAI_AGAIN']);

module.exports.logError = (exception, { forceExit = false } = {}) => {
  const exceptionMeta = resolveExceptionMeta(exception);
  const isUserError = userErrorNames.has(exceptionMeta.name);
  const isNetworkError = networkErrorNames.has(exceptionMeta.name);

...
..
.

Then update logError logic to surface the Error message you prefer?

@medikoo
Copy link
Contributor Author

medikoo commented Jun 18, 2020

@chrisVillanueva your proposal looks great. It's just that we detect network errors by codes not names (error.code property), but it's definitely this direction.

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

2 participants