add WALLET_NOT_FOUND
This commit is contained in:
parent
6270a326b7
commit
03fe48209e
|
@ -26,6 +26,7 @@ var errors = {
|
|||
WALLET_ALREADY_EXISTS: 'Wallet already exists',
|
||||
WALLET_FULL: 'Wallet full',
|
||||
WALLET_NOT_COMPLETE: 'Replace only works on complete wallets',
|
||||
WALLET_NOT_FOUND: 'Wallet not found',
|
||||
};
|
||||
|
||||
var errorObjects = _.zipObject(_.map(errors, function(msg, code) {
|
||||
|
|
|
@ -253,7 +253,7 @@ WalletService.prototype.getWallet = function(opts, cb) {
|
|||
|
||||
self.storage.fetchWallet(self.walletId, function(err, wallet) {
|
||||
if (err) return cb(err);
|
||||
if (!wallet) return cb(new ClientError('Wallet not found'));
|
||||
if (!wallet) return cb(Errors.WALLET_NOT_FOUND);
|
||||
return cb(null, wallet);
|
||||
});
|
||||
};
|
||||
|
@ -285,7 +285,7 @@ WalletService.prototype.replaceTemporaryRequestKey = function(opts, cb) {
|
|||
self.storage.fetchWallet(self.walletId, function(err, wallet) {
|
||||
if (err) return cb(err);
|
||||
|
||||
if (!wallet) return cb(new ClientError('Wallet not found'));
|
||||
if (!wallet) return cb(Errors.WALLET_NOT_FOUND);
|
||||
var hash = WalletUtils.getCopayerHash(opts.name, opts.xPubKey, opts.requestPubKey);
|
||||
if (!self._verifySignature(hash, opts.copayerSignature, wallet.pubKey)) {
|
||||
return cb(new ClientError());
|
||||
|
@ -397,7 +397,7 @@ WalletService.prototype.joinWallet = function(opts, cb) {
|
|||
self.storage.fetchWallet(opts.walletId, function(err, wallet) {
|
||||
|
||||
if (err) return cb(err);
|
||||
if (!wallet) return cb(new ClientError('Wallet not found'));
|
||||
if (!wallet) return cb(Errors.WALLET_NOT_FOUND);
|
||||
|
||||
var hash = WalletUtils.getCopayerHash(opts.name, opts.xPubKey, opts.requestPubKey);
|
||||
if (!self._verifySignature(hash, opts.copayerSignature, wallet.pubKey)) {
|
||||
|
|
|
@ -3178,7 +3178,7 @@ describe('Wallet service', function() {
|
|||
should.not.exist(err);
|
||||
server.getWallet({}, function(err, w) {
|
||||
should.exist(err);
|
||||
err.message.should.equal('Wallet not found');
|
||||
err.code.should.equal('WALLET_NOT_FOUND');
|
||||
should.not.exist(w);
|
||||
async.parallel([
|
||||
|
||||
|
@ -3237,7 +3237,7 @@ describe('Wallet service', function() {
|
|||
function(next) {
|
||||
server.getWallet({}, function(err, wallet) {
|
||||
should.exist(err);
|
||||
err.message.should.contain('not found');
|
||||
err.code.should.equal('WALLET_NOT_FOUND');
|
||||
next();
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue