From e31635300c12a19d2913e7ebfd23c79b3a10ea29 Mon Sep 17 00:00:00 2001 From: Inal Arsanukaev Date: Wed, 2 Oct 2019 18:18:58 +0300 Subject: [PATCH] Added error mapping for sleep timeout reached --- pom.xml | 2 +- .../spring/boot/starter/service/IntentServiceImpl.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 329eefb..0866d93 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.rbkmoney adapter-bank-payout-spring-boot-starter - 1.0.1 + 1.0.2 jar Adapter-bank-payout-spring-boot-starter diff --git a/src/main/java/com/rbkmoney/adapter/bank/payout/spring/boot/starter/service/IntentServiceImpl.java b/src/main/java/com/rbkmoney/adapter/bank/payout/spring/boot/starter/service/IntentServiceImpl.java index 401f1f0..1e518e4 100644 --- a/src/main/java/com/rbkmoney/adapter/bank/payout/spring/boot/starter/service/IntentServiceImpl.java +++ b/src/main/java/com/rbkmoney/adapter/bank/payout/spring/boot/starter/service/IntentServiceImpl.java @@ -4,7 +4,6 @@ import com.rbkmoney.adapter.bank.payout.spring.boot.starter.config.properties.Ti import com.rbkmoney.adapter.bank.payout.spring.boot.starter.model.EntryStateModel; import com.rbkmoney.adapter.bank.payout.spring.boot.starter.model.ExitStateModel; import com.rbkmoney.damsel.base.Timer; -import com.rbkmoney.damsel.domain.Failure; import com.rbkmoney.damsel.domain.TransactionInfo; import com.rbkmoney.damsel.withdrawals.provider_adapter.*; import com.rbkmoney.error.mapping.ErrorMapping; @@ -42,9 +41,9 @@ public class IntentServiceImpl implements IntentService { throw new IllegalArgumentException("Need to specify 'maxTimePoolingMillis' before sleep"); } if (exitStateModel.getNextState().getMaxTimePoolingMillis() < Instant.now().toEpochMilli()) { - final Failure failure = new Failure("Sleep timeout"); - failure.setReason("Max time pool limit reached"); - return Intent.finish(new FinishIntent(FinishStatus.failure(failure))); + String code = "Sleep timeout"; + String reason = "Max time pool limit reached"; + return Intent.finish(new FinishIntent(FinishStatus.failure(errorMapping.mapFailure(code, reason)))); } int timerPollingDelay = OptionsExtractors.extractPollingDelay(exitStateModel.getEntryStateModel().getOptions(), timerProperties.getPollingDelay());