Permalink
Browse files

Merge pull request #392 from nodejitsu/timeout-errs

[fix] fix for differentiating socket hang up vs local timeouts
  • Loading branch information...
2 parents aa6fc40 + b3b3a1a commit da85b7d0e4e43461d941b5635f4487263e159332 @AvianFlu AvianFlu committed Feb 19, 2013
Showing with 9 additions and 20 deletions.
  1. +9 −20 lib/jitsu.js
View
29 lib/jitsu.js
@@ -363,26 +363,15 @@ jitsu.showError = function (command, err, shallow, skip) {
}
else {
if (err.stack && !shallow) {
- if (err.message && err.message === 'socket hang up') {
- if (err.code) {
- jitsu.log.info('');
- if (err.code === 'ECONNRESET') {
- jitsu.log.info(
- 'jitsu\'s client request timed out before the server ' +
- 'could respond. Please increase your client timeout' +
- '(Ex. `jitsu config set timeout 100000`)'
- );
- jitsu.log.help(
- 'This error may be due to network connection problems'
- );
- } else {
- jitsu.log.info('The nodejitsu api reset the connection');
- jitsu.log.help(
- 'This error may be due to the application or the drone server'
- );
- }
-
- }
+ if (err.message && err.message === 'socket hang up' && err.code && err.code === 'ECONNRESET') {
+ jitsu.log.info('The nodejitsu api reset the connection');
+ jitsu.log.help('This error may be due to the application or the drone server');
+ } else if (err.message && err.message === 'ETIMEDOUT'){
+ jitsu.log.info(
+ 'jitsu\'s client request timed out before the server ' +
+ 'could respond. Please increase your client timeout');
+ jitsu.log.help('(Example: `jitsu config set timeout 100000`)');
+ jitsu.log.help('This error may be due to network connection problems');
} else {
err.stack.split('\n').forEach(function (trace) {
jitsu.log.error(trace);

0 comments on commit da85b7d

Please sign in to comment.