Browse Source

add WALLET_LOCKED error on lock timeout

activeAddress
Ivan Socolsky 9 years ago
parent
commit
524ed773e2
  1. 1
      lib/errors/errordefinitions.js
  2. 4
      lib/lock.js

1
lib/errors/errordefinitions.js

@ -29,6 +29,7 @@ var errors = {
UPGRADE_NEEDED: 'Client app needs to be upgraded',
WALLET_ALREADY_EXISTS: 'Wallet already exists',
WALLET_FULL: 'Wallet full',
WALLET_LOCKED: 'Wallet is locked',
WALLET_NOT_COMPLETE: 'Wallet is not complete',
WALLET_NOT_FOUND: 'Wallet not found',
};

4
lib/lock.js

@ -7,6 +7,8 @@ log.disableColor();
var LocalLock = require('./locallock');
var RemoteLock = require('locker');
var Errors = require('./errors/errordefinitions');
function Lock(opts) {
opts = opts || {};
if (opts.lockerServer) {
@ -29,7 +31,7 @@ Lock.prototype.runLocked = function(token, cb, task) {
$.shouldBeDefined(token);
this.lock.locked(token, 5 * 1000, 24 * 60 * 60 * 1000, function(err, release) {
if (err) return cb(new Error('Wallet is locked'));
if (err) return cb(Errors.WALLET_LOCKED);
var _cb = function() {
cb.apply(null, arguments);
release();

Loading…
Cancel
Save