Expose more information for migration status errors (#240)

We saw these errors live today and it would be helpful to have the
additional error context for debugging.
This commit is contained in:
Zach Wasserman 2021-01-28 09:49:06 -08:00 committed by GitHub
parent bb124dc2b9
commit ac9a85ab88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,22 +193,22 @@ func (d *Datastore) MigrationStatus() (kolide.MigrationStatus, error) {
lastTablesMigration, err := tables.MigrationClient.Migrations.Last() lastTablesMigration, err := tables.MigrationClient.Migrations.Last()
if err != nil { if err != nil {
return 0, errors.New("missing tables migrations") return 0, errors.Wrap(err, "missing tables migrations")
} }
currentTablesVersion, err := tables.MigrationClient.GetDBVersion(d.db.DB) currentTablesVersion, err := tables.MigrationClient.GetDBVersion(d.db.DB)
if err != nil { if err != nil {
return 0, errors.New("cannot get table migration status") return 0, errors.Wrap(err, "cannot get table migration status")
} }
lastDataMigration, err := data.MigrationClient.Migrations.Last() lastDataMigration, err := data.MigrationClient.Migrations.Last()
if err != nil { if err != nil {
return 0, errors.New("missing data migrations") return 0, errors.Wrap(err, "missing data migrations")
} }
currentDataVersion, err := data.MigrationClient.GetDBVersion(d.db.DB) currentDataVersion, err := data.MigrationClient.GetDBVersion(d.db.DB)
if err != nil { if err != nil {
return 0, errors.New("cannot get table migration status") return 0, errors.Wrap(err, "cannot get data migration status")
} }
switch { switch {