Class SmsTimeoutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.sms.exception.SmsException
cloud.opencode.base.sms.exception.SmsTimeoutException
- All Implemented Interfaces:
Serializable
SMS Timeout Exception
短信超时异常
Exception thrown when SMS operations time out.
短信操作超时时抛出的异常。
Features | 主要功能:
- Timeout type classification (CONNECTION, READ, TOTAL) - 超时类型分类
- Timeout duration and operation tracking - 超时时长和操作跟踪
Usage Examples | 使用示例:
throw new SmsTimeoutException(SmsErrorCode.SEND_TIMEOUT,
SmsTimeoutException.TimeoutType.READ, Duration.ofSeconds(30), "sendSms");
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Since:
- JDK 25, opencode-base-sms V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTimeout type enumeration 超时类型枚举 -
Constructor Summary
ConstructorsConstructorDescriptionSmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout) SmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout, String operation) SmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic SmsTimeoutExceptionconnectionTimeout(Duration timeout) Creates a connection timeout exception 创建连接超时异常static SmsTimeoutExceptionconnectionTimeout(Duration timeout, Throwable cause) Creates a connection timeout exception with cause 创建带原因的连接超时异常Gets the operation that timed out 获取超时的操作Gets the timeout duration 获取超时时长Gets the timeout type 获取超时类型static SmsTimeoutExceptionreadTimeout(Duration timeout) Creates a read timeout exception 创建读取超时异常static SmsTimeoutExceptionreadTimeout(Duration timeout, Throwable cause) Creates a read timeout exception with cause 创建带原因的读取超时异常static SmsTimeoutExceptionsendTimeout(Duration timeout, String operation) Creates a send timeout exception 创建发送超时异常Methods inherited from class SmsException
getCode, getErrorCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SmsTimeoutException
public SmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout) -
SmsTimeoutException
public SmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout, String operation) -
SmsTimeoutException
public SmsTimeoutException(SmsErrorCode errorCode, SmsTimeoutException.TimeoutType timeoutType, Duration timeout, Throwable cause)
-
-
Method Details
-
getTimeoutType
Gets the timeout type 获取超时类型- Returns:
- timeout type | 超时类型
-
getTimeout
-
getOperation
Gets the operation that timed out 获取超时的操作- Returns:
- operation name or null | 操作名称或null
-
connectionTimeout
Creates a connection timeout exception 创建连接超时异常- Parameters:
timeout- timeout duration | 超时时长- Returns:
- timeout exception | 超时异常
-
connectionTimeout
Creates a connection timeout exception with cause 创建带原因的连接超时异常- Parameters:
timeout- timeout duration | 超时时长cause- original exception | 原始异常- Returns:
- timeout exception | 超时异常
-
readTimeout
Creates a read timeout exception 创建读取超时异常- Parameters:
timeout- timeout duration | 超时时长- Returns:
- timeout exception | 超时异常
-
readTimeout
Creates a read timeout exception with cause 创建带原因的读取超时异常- Parameters:
timeout- timeout duration | 超时时长cause- original exception | 原始异常- Returns:
- timeout exception | 超时异常
-
sendTimeout
Creates a send timeout exception 创建发送超时异常- Parameters:
timeout- timeout duration | 超时时长operation- operation description | 操作描述- Returns:
- timeout exception | 超时异常
-