Fix failure transaction error message (#74)

This commit is contained in:
Baikov Dmitrii 2019-08-15 17:53:10 +03:00 committed by GitHub
parent 2ea7ff8f59
commit 7976fb8498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -12,7 +12,7 @@
<groupId>com.rbkmoney</groupId>
<artifactId>midgard</artifactId>
<version>1.6.1-SNAPSHOT</version>
<version>1.6.2-SNAPSHOT</version>
<name>midgard</name>
<description>Application for work with clearing data</description>

View File

@ -71,7 +71,8 @@ public class ClearingTransactionPackageHandler implements ClearingPackageHandler
++transactionPackageCount);
}
} catch (Throwable th) {
serviceFailureTransactionHandler.handleTransaction(info, th.getMessage());
log.error("Cought error while processing transaction {}:", info, th);
serviceFailureTransactionHandler.handleTransaction(info, th.toString());
}
}
return transactions;

View File

@ -29,14 +29,15 @@ public class ServiceFailureTransactionHandler implements FailureTransactionHandl
private void saveFailureTransaction(ClearingEventTransactionInfo info, String errorMessage) throws Exception {
switch (info.getTransactionType()) {
case PAYMENT:
log.error("Error was caught while clearing processed {} transaction with invoice_id {} and payment id {}",
info.getTransactionType(), info.getInvoiceId(), info.getPaymentId());
log.error("Error was caught while clearing processed {} transaction with invoice_id {} and " +
"payment id {}. Reason: \n{}", info.getTransactionType(), info.getInvoiceId(),
info.getPaymentId(), errorMessage);
transactionsDao.saveFailureTransaction(getFailureTransaction(info, errorMessage, PAYMENT));
break;
case REFUND:
log.error("Error was caught while clearing processed {} transaction with invoice_id {}, payment id {} " +
"and refund id {}", info.getTransactionType(), info.getInvoiceId(), info.getPaymentId(),
info.getRefundId());
"and refund id {}. Reason: \n{}", info.getTransactionType(), info.getInvoiceId(),
info.getPaymentId(), info.getRefundId(), errorMessage);
transactionsDao.saveFailureTransaction(getFailureTransaction(info, errorMessage, REFUND));
break;
default: