Skip to content

Commit

Permalink
Adding even BETTER error handling that catches ECONREFUSED when carbo…
Browse files Browse the repository at this point in the history
…n it totally offline
  • Loading branch information
chuyskywalker authored and kastner committed May 3, 2011
1 parent 4b4adb4 commit e4b3d0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion stats.js
Expand Up @@ -121,12 +121,19 @@ config.configFile(process.argv[2], function (config, oldConfig) {

try {
var graphite = net.createConnection(config.graphitePort, config.graphiteHost);
graphite.addListener('error', function(connectionException){
if (config.debug) {
sys.log(connectionException);
}
});
graphite.on('connect', function() {
this.write(statString);
this.end();
});
} catch(e){
// no big deal
if (config.debug) {
sys.log(e);
}
}

}, flushInterval);
Expand Down

0 comments on commit e4b3d0e

Please sign in to comment.