fix #26: check db file existence before trying to read from it (#27)

This commit is contained in:
T. von Dein
2026-08-31 21:12:50 +02:00
parent cafc65aea7
commit 5c9900d985
3 changed files with 17 additions and 1 deletions

View File

@@ -91,6 +91,14 @@ func New(file string, bucket string, debug bool) (*DB, error) {
return &DB{Debug: debug, Dbfile: file, Bucket: bucket}, nil
}
func (db *DB) Exists() error {
if !common.FileExists(db.Dbfile) {
return fmt.Errorf("db file %s doesn't exist", db.Dbfile)
}
return nil
}
func (db *DB) Open() error {
slog.Debug("opening DB", "dbfile", db.Dbfile)