Class OpenFunctionalException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.functional.exception.OpenFunctionalException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OpenMatchException
OpenFunctionalException - Base exception for functional operations
OpenFunctionalException - 函数式操作的基础异常
Base exception for all functional programming related errors including monad failures, computation errors, and pipeline exceptions.
所有函数式编程相关错误的基础异常,包括 Monad 失败、计算错误和管道异常。
Features | 主要功能:
- Component identification - 组件标识
- Error code support - 错误码支持
- Factory methods for common errors - 常见错误的工厂方法
Usage Examples | 使用示例:
// Direct creation
throw new OpenFunctionalException("Computation failed");
// With cause
throw new OpenFunctionalException("Mapping failed", cause);
// Factory methods
throw OpenFunctionalException.computationFailed("Division by zero");
throw OpenFunctionalException.noValue("Option is empty");
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Serializable: Yes - 可序列化: 是
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenFunctionalException(String message) Create exception with message 创建带消息的异常OpenFunctionalException(String errorCode, String message) Create exception with error code and message 创建带错误码和消息的异常OpenFunctionalException(String errorCode, String message, Throwable cause) Create exception with error code, message and cause 创建带错误码、消息和原因的异常OpenFunctionalException(String message, Throwable cause) Create exception with message and cause 创建带消息和原因的异常 -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenFunctionalExceptioncomputationFailed(String message) Create exception for computation failure 为计算失败创建异常static OpenFunctionalExceptioncomputationFailed(String message, Throwable cause) Create exception for computation failure with cause 为带原因的计算失败创建异常static OpenFunctionalExceptionfilterFailed(String message) Create exception for filter failure 为过滤失败创建异常static OpenFunctionalExceptioninvalidState(String message) Create exception for invalid state 为无效状态创建异常static OpenFunctionalExceptionmappingFailed(Throwable cause) Create exception for mapping failure 为映射失败创建异常static OpenFunctionalExceptionCreate exception for missing value 为缺少值创建异常Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
COMPONENT
-
-
Constructor Details
-
OpenFunctionalException
Create exception with message 创建带消息的异常- Parameters:
message- error message | 错误消息
-
OpenFunctionalException
-
OpenFunctionalException
-
OpenFunctionalException
-
-
Method Details
-
computationFailed
Create exception for computation failure 为计算失败创建异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-
computationFailed
Create exception for computation failure with cause 为带原因的计算失败创建异常- Parameters:
message- error message | 错误消息cause- original exception | 原始异常- Returns:
- exception instance | 异常实例
-
noValue
Create exception for missing value 为缺少值创建异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-
invalidState
Create exception for invalid state 为无效状态创建异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-
mappingFailed
Create exception for mapping failure 为映射失败创建异常- Parameters:
cause- original exception | 原始异常- Returns:
- exception instance | 异常实例
-
filterFailed
Create exception for filter failure 为过滤失败创建异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-