From 6bdd4b2670906588852fc4dda457607b4aac08e4 Mon Sep 17 00:00:00 2001 From: Geert Weening Date: Tue, 11 Nov 2014 16:54:25 -0800 Subject: [PATCH] [TASK] wait for validation before returning tec error --- src/js/ripple/transactionmanager.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/js/ripple/transactionmanager.js b/src/js/ripple/transactionmanager.js index 0f48769f..7c26afb0 100644 --- a/src/js/ripple/transactionmanager.js +++ b/src/js/ripple/transactionmanager.js @@ -46,8 +46,16 @@ function TransactionManager(account) { } if (submission instanceof Transaction) { + // ND: A `success` handler will `finalize` this later - submission.emit('success', transaction); + switch (transaction.engine_result) { + case 'tesSUCCESS': + submission.emit('success', transaction); + break; + default: + submission.emit('error', transaction); + } + } else { self._pending.addReceivedId(hash, transaction); } @@ -413,8 +421,6 @@ TransactionManager.prototype._request = function(tx) { if (tx.finalized) { return; } - - tx.emit('error', message); }; function transactionFailedLocal(message) {