Skip to content

Commit

Permalink
cherry pick #2652 to release-1.1 (#2667)
Browse files Browse the repository at this point in the history
Signed-off-by: sre-bot <[email protected]>

Co-authored-by: Song Gao <[email protected]>
  • Loading branch information
sre-bot and Yisaer authored Jun 9, 2020
1 parent 814e8cf commit 47e9c00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/backup-manager/app/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ func EnsureDirectoryExist(dirName string) error {
func OpenDB(dsn string) (*sql.DB, error) {
db, err := sql.Open("mysql", dsn)
if err != nil {
return nil, fmt.Errorf("open dsn %s failed, err: %v", dsn, err)
return nil, fmt.Errorf("open datasource failed, err: %v", err)
}
if err := db.Ping(); err != nil {
db.Close()
return nil, fmt.Errorf("cannot connect to mysql: %s, err: %v", dsn, err)
return nil, fmt.Errorf("cannot connect to mysql, err: %v", err)
}
return db, nil
}
Expand Down

0 comments on commit 47e9c00

Please sign in to comment.