Skip to content

Commit

Permalink
Catch exceptions due to parseURL.
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuo committed Jun 11, 2010
1 parent 564a7df commit 74123f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/nodetk/web.js
Expand Up @@ -27,7 +27,13 @@ var check_url = exports.check_url = function(url, options, callback, fallback) {
var options = extend({
max_redirects: 3
}, options);
var parsed_url = URL.parse(url);
var parsed_url;
try {
parsed_url = URL.parse(url);
} catch (e) {
sys.puts("Error on client:", error.message, '\n', error.stack);
fallback && fallback(error);
}
var client = http.createClient(parsed_url.port || 80, parsed_url.hostname);
client.addListener('error', function(error) {
sys.puts("Error on client:", error.message, '\n', error.stack);
Expand Down

0 comments on commit 74123f3

Please sign in to comment.