Fixed typo and moved LockError emitting to inside _getLock function

This commit is contained in:
Mikael Lepistö 2015-12-15 21:43:57 +02:00
parent d510b2377f
commit 9236ca95e3
2 changed files with 4 additions and 5 deletions

View File

@ -169,10 +169,12 @@ export default class Migrator {
return this._isLocked(trx)
.then(isLocked => {
if (isLocked) {
throw new Error("Migration table is are already locked");
throw new Error("Migration table is already locked");
}
})
.then(() => this._lockMigrations(trx));
}).catch(err => {
throw new LockError(err.message);
});
}
@ -185,9 +187,6 @@ export default class Migrator {
// Run a batch of current migrations, in sequence.
_runBatch(migrations, direction) {
return this._getLock()
.catch(err => {
throw new LockError(err.message);
})
.then(() => Promise.all(_.map(migrations, this._validateMigrationStructure, this)))
.then(() => this._latestBatchNumber())
.then(batchNo => {

View File

@ -153,7 +153,7 @@ module.exports = function(knex) {
});
})
.catch(function(error) {
expect(error).to.have.property('message', 'Migration table is are already locked');
expect(error).to.have.property('message', 'Migration table is already locked');
return knex('knex_migrations_lock').select('*');
})
.then(function(data) {