Merge pull request #399 from sosedoff/fix-start-with-default-db

Do not exit with error if local server is not running
This commit is contained in:
Dan Sosedoff 2018-12-18 20:23:09 -06:00 committed by GitHub
commit aadee6ac8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,12 +80,17 @@ func initClient() {
msg := err.Error() msg := err.Error()
// Check if we're trying to connect to the default database. // Check if we're trying to connect to the default database.
// If database does not exist, allow user to connect from the UI.
if command.Opts.DbName == "" { if command.Opts.DbName == "" {
// If database does not exist, allow user to connect from the UI.
if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") { if strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") {
fmt.Println("Error:", msg) fmt.Println("Error:", msg)
return return
} }
// Do not bail if local server is not running.
if strings.Contains(msg, "connection refused") {
fmt.Println("Error:", msg)
return
}
} }
exitWithMessage(msg) exitWithMessage(msg)