Skip to content
Permalink
Browse files

fix: fix error codes in base lock

  • Loading branch information...
satazor committed Apr 17, 2019
1 parent 05a9715 commit 25c6302ecf2f628fb72f44dcd1f68eb8b4071372
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/locker/locks/base.js
@@ -35,23 +35,23 @@ export default class BaseLock {

#assertNotMaster = () => {
if (this.#master) {
throw new Error('Invalid operation on the master lock', { code: 'INVALID_OPERATION' });
throw Object.assign(new Error('Invalid operation on the master lock'), { code: 'INVALID_OPERATION' });
}
}

#assertEnabled = async () => {
const enabled = await this.isEnabled();

if (!enabled) {
throw new Error('This lock must be enabled', { code: 'NOT_ENABLED' });
throw Object.assign(new Error('This lock must be enabled'), { code: 'NOT_ENABLED' });
}
}

#assertDisabled = async () => {
const enabled = await this.isEnabled();

if (enabled) {
throw new Error('This lock must be disabled', { code: 'NOT_DISABLED' });
throw Object.assign(new Error('This lock must be disabled'), { code: 'NOT_DISABLED' });
}
}
}

0 comments on commit 25c6302

Please sign in to comment.
You can’t perform that action at this time.