Merge pull request #14 from rbkmoney/ft/error_mapping_sleep

Added error mapping for sleep timeout reached
This commit is contained in:
Inal Arsanukaev 2019-10-02 18:22:50 +03:00 committed by GitHub
commit 240cf407f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.rbkmoney</groupId>
<artifactId>adapter-bank-payout-spring-boot-starter</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<packaging>jar</packaging>
<name>Adapter-bank-payout-spring-boot-starter</name>

View File

@ -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());