Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created June 18, 2011 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/1033563 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1033563 to your computer and use it in GitHub Desktop.
ebadname.js - uncatchable exception
var http = require('http');
var host = '********';
host += host;
host += host;
host += host;
host += host;
host += host;
try {
// raises uncatchable EBADNAME
http.get({host:host, port:80}, console.error);
}
catch (e) {
console.error('Caught exception', e);
}
Copy link

ghost commented Jun 18, 2011

// This test can help to check if a domain is 'good' or not

var dns = require('dns');

dns.resolve("www.google.com",'A', function(err, addresses) {

if(err) {
    console.log(err);
}
else
{
    console.dir(addresses);
}

});

dns.resolve("www.google.com..",'A', function(err, addresses) {

    if(err) {
            console.log(err);
    }
    else
    {
            console.dir(addresses);
    }

});

Copy link

ghost commented Jun 18, 2011

This test can help to check if a domain is 'good' or not:

var dns = require('dns');

dns.resolve("www.google.com",'A', function(err, addresses) {

    if(err) {
        console.log(err);
    }
    else
    {
        console.dir(addresses);
    }
});

dns.resolve("www.google.com..",'A', function(err, addresses) {

        if(err) {
                console.log(err);
        }
        else
        {
                console.dir(addresses);
        }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment