summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-exceptions.js
blob: e82485c0b309961cad80837bc288bea9e6e2e29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
require('../common');
var http = require('http');

var server = http.createServer(function(req, res) {
  intentionally_not_defined(); // eslint-disable-line no-undef
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('Thank you, come again.');
  res.end();
});

server.listen(0, function() {
  for (var i = 0; i < 4; i += 1) {
    http.get({ port: this.address().port, path: '/busy/' + i });
  }
});

var exception_count = 0;

process.on('uncaughtException', function(err) {
  console.log('Caught an exception: ' + err);
  if (err.name === 'AssertionError') throw err;
  if (++exception_count == 4) process.exit(0);
});