SQUASHME update db error names
This commit is contained in:
@ -24,11 +24,11 @@ type DB struct {
|
||||
}
|
||||
|
||||
var (
|
||||
ErrDatabaseNotInitialized = errors.New("database not initialized")
|
||||
ErrDatabaseAlreadyInitialized = errors.New("database already initialized")
|
||||
ErrDatabaseSchemaOutdated = errors.New("database schema needs updating")
|
||||
ErrDatabaseSchemaUnsupported = errors.New("database schema is too new for the server")
|
||||
ErrMigrationFailed = errors.New("migration failed")
|
||||
ErrNotInitialized = errors.New("database not initialized")
|
||||
ErrAlreadyInitialized = errors.New("database already initialized")
|
||||
ErrSchemaOutdated = errors.New("database schema needs updating")
|
||||
ErrSchemaUnsupported = errors.New("database schema is too new for the server")
|
||||
ErrMigrationFailed = errors.New("migration failed")
|
||||
)
|
||||
|
||||
// Open opens a connection to the sqlite database at the given path
|
||||
@ -66,7 +66,7 @@ func (db *DB) Close() error {
|
||||
func (db *DB) Initialize(schemaPath string) error {
|
||||
err := db.CheckInitialized()
|
||||
if err == nil {
|
||||
return ErrDatabaseAlreadyInitialized
|
||||
return ErrAlreadyInitialized
|
||||
}
|
||||
|
||||
currentSchema := filepath.Join(schemaPath, "current.sql")
|
||||
@ -92,7 +92,7 @@ func (db *DB) CheckInitialized() error {
|
||||
}
|
||||
|
||||
if count == 0 {
|
||||
return ErrDatabaseNotInitialized
|
||||
return ErrNotInitialized
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -128,9 +128,9 @@ func (db *DB) CheckSchemaVersion() error {
|
||||
return err
|
||||
}
|
||||
if version_ < version.SchemaVersion {
|
||||
return ErrDatabaseSchemaOutdated
|
||||
return ErrSchemaOutdated
|
||||
} else if version_ > version.SchemaVersion {
|
||||
return ErrDatabaseSchemaUnsupported
|
||||
return ErrSchemaUnsupported
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user