mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-14 10:23:02 +03:00
Merge pull request #389 from sosedoff/fix-startup-with-default-db
Fix startup behavior when user did not provide a database name
This commit is contained in:
commit
420478ce6e
@ -77,7 +77,18 @@ func initClient() {
|
||||
fmt.Println("Connecting to server...")
|
||||
err = cl.Test()
|
||||
if err != nil {
|
||||
exitWithMessage(err.Error())
|
||||
msg := err.Error()
|
||||
|
||||
// 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 strings.Contains(msg, "database") && strings.Contains(msg, "does not exist") {
|
||||
fmt.Println("Error:", msg)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
exitWithMessage(msg)
|
||||
}
|
||||
|
||||
if !command.Opts.Sessions {
|
||||
|
Loading…
Reference in New Issue
Block a user