Skip to content

Instantly share code, notes, and snippets.

@mrjf
Created July 20, 2012 00:18
Show Gist options
  • Save mrjf/3147852 to your computer and use it in GitHub Desktop.
Save mrjf/3147852 to your computer and use it in GitHub Desktop.
Causes error: events.js:66 throw arguments[1]; // Unhandled 'error' event ^ Error: Parse Error at Socket.socketOnData (http.js:1356:20) at TCP.onread (net.js:404:27)
request = require 'request'
urls = ('123fastpay.com' for i in [1..35])
for url in urls
try
request 'http://' + url, (error, response, body) ->
console.log 'url is back:', response
catch error
console.log error
// Generated by CoffeeScript 1.3.1
(function() {
var i, request, url, urls, _i, _len;
request = require('request');
urls = (function() {
var _i, _results;
_results = [];
for (i = _i = 1; _i <= 35; i = ++_i) {
_results.push('123fastpay.com');
}
return _results;
})();
for (_i = 0, _len = urls.length; _i < _len; _i++) {
url = urls[_i];
try {
request('http://' + url, function(error, response, body) {
return console.log('url is back:', response);
});
} catch (error) {
console.log(error);
}
}
}).call(this);
$ node case.js
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
url is back: undefined
events.js:66
throw arguments[1]; // Unhandled 'error' event
^
Error: Parse Error
at Socket.socketOnData (http.js:1356:20)
at TCP.onread (net.js:404:27)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment