Skip to content

Commit

Permalink
Fix displaying connection error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxa committed Apr 6, 2017
1 parent 7c20d02 commit 8170ed1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ global.App = {
humanErrorMessage: (error) => {
if (error == "connect ECONNREFUSED") {
return "Connection refused.<br>Make sure postgres is running";
} else if (error.match(/^getaddrinfo ENOTFOUND/)) {
var host = error.match(/^getaddrinfo ENOTFOUND\s+(.+)$/);
return `Can not resolve host '${host[1]}'`;
} else {
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion app/login_screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ global.LoginScreen = jClass.extend({
window.alertify.alert("Successfully connected!");
conn.close();
} else {
window.alertify.alert(this.humanErrorMessage(message));
window.alertify.alert(App.humanErrorMessage(message));
}
});
},
Expand Down

0 comments on commit 8170ed1

Please sign in to comment.