mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix error handling
This commit is contained in:
parent
8aec786a6d
commit
dff85e9c71
|
@ -63,9 +63,11 @@ func (store *SqliteStore) initialize(dbFile, createTable, upsertQuery string) (e
|
||||||
var dbErr error
|
var dbErr error
|
||||||
store.DB, dbErr = sql.Open("sqlite", dbFile)
|
store.DB, dbErr = sql.Open("sqlite", dbFile)
|
||||||
if dbErr != nil {
|
if dbErr != nil {
|
||||||
|
if store.DB != nil {
|
||||||
store.DB.Close()
|
store.DB.Close()
|
||||||
store.DB = nil
|
store.DB = nil
|
||||||
return fmt.Errorf("can not connect to %s error:%v", dbFile, err)
|
}
|
||||||
|
return fmt.Errorf("can not connect to %s error:%v", dbFile, dbErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = store.DB.Ping(); err != nil {
|
if err = store.DB.Ping(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue