Permalink
Browse files

Adding even BETTER error handling that catches ECONREFUSED when carbo…

…n it totally offline
  • Loading branch information...
1 parent 4dde41a commit 7b8428cc943b543ccf89c19693ee6e5bb9d45886 @chuyskywalker committed May 3, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 stats.js
View
@@ -156,12 +156,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);

1 comment on commit 7b8428c

kastner commented on 7b8428c May 3, 2011

ah! very cool!

Please sign in to comment.