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

Provide more information for socket errors #58

Closed
ricellis opened this issue Jul 24, 2017 · 0 comments · Fixed by #285
Closed

Provide more information for socket errors #58

ricellis opened this issue Jul 24, 2017 · 0 comments · Fixed by #285

Comments

@ricellis
Copy link
Contributor

It would be helpful to provide additional error information in the message Nano outputs for socket or connection errors.

Expected Behavior

Suggest including, for example, reading the error .code and .description and adding it to the message to provide some more useful diagnostics.

{
  code: 'ECONNRESET',
  description: 'socket hang up'
}

err.message -> error happened in your connection ECONNRESET socket hang up

Current Behavior

Currently for a socket/connection error only the err.message is set to error happened in your connection.

err.message -> error happened in your connection

Possible Solution

Could build up the error message to include .code and .description if they are available e.g.

  if (err && err.code) {
    err.message = `${err.message} ${err.code}`;
  }
  if (err && err.description) {
    err.message = `${err.message} ${err.description}`;
  }

Steps to Reproduce (for bugs)

  1. Could use nock replyWithError to reproduce e.g.
nock.get(...).replyWithError({'description': 'socket hang up', 'code': 'ECONNRESET'});

Context

Made it hard to debug some connection issues without adding additional output statements to see the underlying cause of the error. Similarly to #54 where the whole error object has been output because the message error happened in your connection is insufficient to identify the issue.

Your Environment

  • Version used:

6.4.0

  • Browser Name and version:

Node.js 8.2.0

  • Operating System and version (desktop or mobile):

macOS 10.12.6

  • Link to your project:

https://github.com/cloudant/nodejs-cloudant

gboer added a commit to gboer/couchdb-nano that referenced this issue Dec 9, 2021
…to support easier debugging of connection issues (issue apache#58)
gboer added a commit to gboer/couchdb-nano that referenced this issue Dec 9, 2021
…when connecting, to support easier debugging of connection issues
glynnbird pushed a commit that referenced this issue Dec 21, 2021
* The mocked/unmocked tests do not exist anymore

* Fixes #58: Include additional information when something fails when connecting, to support easier debugging of connection issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant