From 766dc5d0ce60e8323e8162dd2a195ad2c6471181 Mon Sep 17 00:00:00 2001 From: Ivan Tivonenko Date: Fri, 10 Jul 2015 22:46:33 +0300 Subject: [PATCH] [FIX] fix getTransaction Do not try to parse transaction if there was error Throw NotFoundError instead of ApiError in case of ledger_index not defined. --- src/api/ledger/transaction.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/ledger/transaction.js b/src/api/ledger/transaction.js index 4a89a75c..0a3d594d 100644 --- a/src/api/ledger/transaction.js +++ b/src/api/ledger/transaction.js @@ -12,7 +12,7 @@ function attachTransactionDate(remote, tx, callback) { return; } if (!tx.ledger_index) { - callback(new errors.ApiError('ledger_index not found in tx')); + callback(new errors.NotFoundError('ledger_index not found in tx')); return; } @@ -48,6 +48,8 @@ function getTransaction(identifier, options, callback) { + ' but the server\'s ledger history is incomplete')); } else if (!error && !isTransactionInRange(tx, options)) { callback(new errors.NotFoundError('Transaction not found')); + } else if (error) { + callback(error); } else { callback(error, parseTransaction(tx)); }