Skip to content

Commit

Permalink
RetryFailedException
Browse files Browse the repository at this point in the history
  • Loading branch information
chentianming11 committed Jun 6, 2022
1 parent 0cabac2 commit 8e720b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.lianjiatech.retrofit.spring.boot.exception;

/**
* @author 陈添明
* @since 2022/6/6 9:59 上午
*/
public class RetryFailedException extends RuntimeException {

public RetryFailedException(String message) {
super(message);
}

public RetryFailedException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Objects;
import java.util.stream.Collectors;

import com.github.lianjiatech.retrofit.spring.boot.exception.RetryFailedException;
import com.github.lianjiatech.retrofit.spring.boot.util.AnnotationExtendUtils;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -80,7 +81,7 @@ protected Response retryIntercept(int maxRetries, int intervalMs, RetryRule[] re
} else {
if (!retryStrategy.shouldRetry()) {
// 最后一次还没成功,抛出异常
throw new RuntimeException("Retry Failed: Total " + maxRetries
throw new RetryFailedException("Retry Failed: Total " + maxRetries
+ " attempts made at interval " + intervalMs
+ "ms");
}
Expand Down

0 comments on commit 8e720b0

Please sign in to comment.