When server is down, the error message is not useful
See original GitHub issueMy 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?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
When server is down, the error message is not useful #314
My test suit is hitting a server with a bunch of requests and then checks on responses. supertest is really good for making...
Read more >What is the best the message "Server is not Running" or ...
The answer depends on goals of the message. If your goal is just to inform user about server status, the first message is...
Read more >HTTP status code when the server is down?
If your server is down like in: shutdown, or service not started, you obviously can't send a custom error code. You will get...
Read more >How To Deal With A Server Not Found Message?
The server not found error means that the server cannot be found, which is quite alarming. It's essential to have a relatively simple...
Read more >Website down? Server down? 5 network troubleshooting tools ...
We've all been there: A website refuses to load, returning a generic “website is not available” or “URL was not found on this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any update on this one? Is it possible to merge #237 fix into latest version?
https://github.com/visionmedia/supertest/pull/446 should help reveal the underlying error here.