Permalink
Browse files

added try for synchronous dns call

  • Loading branch information...
1 parent 65983e8 commit dcd29c22b8b370a46cb72afa3c4f0394f3401879 Geoff Flarity committed Feb 17, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/graphite_axon.js
View
@@ -25,8 +25,16 @@ var GraphiteAxon = function ( namespace, host, port) {
this_axon.port = port;
//note this is async, so everything below will get set first
- this_axon.tcp_connection = net.createConnection( port, host );
-
+ try {
+ this_axon.tcp_connection = net.createConnection( port, host );
+ } catch ( e ) {
+
+ //apparently the dns lookup is sync? I got this:
+ //Error: ECONNREFUSED, Could not contact DNS servers
+ console.log( e );
+ process.exit(1);
+ }
+
//TODO eventually this could get big if we can't send them out for a while
this_axon.message_buffer = [];

0 comments on commit dcd29c2

Please sign in to comment.