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

When server is down, the error message is not useful #314

Closed
sakovias opened this issue Feb 14, 2016 · 5 comments
Closed

When server is down, the error message is not useful #314

sakovias opened this issue Feb 14, 2016 · 5 comments
Labels
too-old Item to old

Comments

@sakovias
Copy link

My test suit is hitting a server with a bunch of requests and then checks on responses. supertest is really good for making tests on response body and status code easy!

However, when the server is down for some reason the error message doesn't allow to identify the source of the problem. Me and some other folks tripped over this a bunch of times :)

var request = require('supertest');
request('localhost:6237')
  .get('/')
  .expect(200)
  .end(function(err, res) {
    if (err) throw err;
    console.log('Success', res.body);
  });

Running this given the server at localhost:6237 is down results in this stack trace:

$ node test.js
/path/to/test.js:8
    if (err) throw err;
                   ^
TypeError: Cannot read property 'status' of undefined

Is it something I can go ahead and fix or it's intended functionality?

@malhar-trivedi
Copy link

@sakovias #237

@jxm262
Copy link

jxm262 commented Mar 12, 2016

After looking at #237 , I'm seeing the same error on the newest version of master. Perhaps the fix was never merged?

@parxier
Copy link

parxier commented Jun 1, 2016

Is there any update on this one?
Is it possible to merge #237 fix into latest version?

@yocontra
Copy link

I'm still getting this error, but it seems to happen randomly. Running the tests again it doesn't happen, maybe 1 out of every 30 runs this happens on a random test.

@bkeepers
Copy link

#446 should help reveal the underlying error here.

@rimiti rimiti added the too-old Item to old label Mar 9, 2019
@rimiti rimiti closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
too-old Item to old
Projects
None yet
Development

No branches or pull requests

7 participants