Package cloud.opencode.base.functional.exception


package cloud.opencode.base.functional.exception
Functional Exceptions - Exception types for functional operations 函数式异常 - 函数式操作的异常类型

Provides exception types specific to functional programming operations including pattern matching failures and functional computation errors.

提供函数式编程操作特定的异常类型,包括模式匹配失败和函数式计算错误。

Exception Types | 异常类型:

Usage Examples | 使用示例:

// Pattern matching failure
try {
    String result = OpenMatch.of(value)
        .caseOf(String.class, s -> "String")
        .orElseThrow();  // Throws OpenMatchException if no match
} catch (OpenMatchException e) {
    Object unmatched = e.unmatchedValue();
}

// Functional computation failure
try {
    User user = Try.of(() -> findUser(id)).get();
} catch (OpenFunctionalException e) {
    // Handle functional error
}
Since:
JDK 25, opencode-base-functional V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Exception Classes
    Class
    Description
    OpenFunctionalException - Base exception for functional operations OpenFunctionalException - 函数式操作的基础异常
    OpenMatchException - Exception for pattern matching failures OpenMatchException - 模式匹配失败的异常