bitcore-wallet-service/lib/errors/errordefinitions.js

40 lines
1.5 KiB
JavaScript

'use strict';
var _ = require('lodash');
var ClientError = require('./clienterror');
var errors = {
BAD_SIGNATURES: 'Bad signatures',
COPAYER_DATA_MISMATCH: 'Copayer data mismatch',
COPAYER_IN_WALLET: 'Copayer already in wallet',
COPAYER_REGISTERED: 'Copayer ID already registered on server',
COPAYER_VOTED: 'Copayer already voted on this transaction proposal',
DUST_AMOUNT: 'Amount below dust threshold',
INCORRECT_ADDRESS_NETWORK: 'Incorrect address network',
INSUFFICIENT_FUNDS: 'Insufficient funds',
INSUFFICIENT_FUNDS_FOR_FEE: 'Insufficient funds for fee',
INVALID_ADDRESS: 'Invalid address',
LOCKED_FUNDS: 'Funds are locked by pending transaction proposals',
NOT_AUTHORIZED: 'Not authorized',
TX_ALREADY_BROADCASTED: 'The transaction proposal is already broadcasted',
TX_CANNOT_CREATE: 'Cannot create TX proposal during backoff time',
TX_CANNOT_REMOVE: 'Cannot remove this tx proposal during locktime',
TX_NOT_ACCEPTED: 'The transaction proposal is not accepted',
TX_NOT_PENDING: 'The transaction proposal is not pending',
UPGRADE_NEEDED: 'Client app needs to be upgraded',
WALLET_ALREADY_EXISTS: 'Wallet already exists',
WALLET_FULL: 'Wallet full',
WALLET_NOT_COMPLETE: 'Replace only works on complete wallets',
};
var errorObjects = _.zipObject(_.map(errors, function(msg, code) {
return [code, new ClientError(code, msg)];
}));
errorObjects.codes = _.mapValues(errors, function(v, k) {
return k;
});
module.exports = errorObjects;