Browse Source

fix error handling

pull/3834/head
chrislu 2 years ago
parent
commit
dff85e9c71
  1. 8
      weed/filer/sqlite/sqlite_store.go

8
weed/filer/sqlite/sqlite_store.go

@ -63,9 +63,11 @@ func (store *SqliteStore) initialize(dbFile, createTable, upsertQuery string) (e
var dbErr error
store.DB, dbErr = sql.Open("sqlite", dbFile)
if dbErr != nil {
store.DB.Close()
store.DB = nil
return fmt.Errorf("can not connect to %s error:%v", dbFile, err)
if store.DB != nil {
store.DB.Close()
store.DB = nil
}
return fmt.Errorf("can not connect to %s error:%v", dbFile, dbErr)
}
if err = store.DB.Ping(); err != nil {

Loading…
Cancel
Save