Class OpenLogException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.log.exception.OpenLogException
- All Implemented Interfaces:
Serializable
Open Log Exception - Logging Component Exception
Open 日志异常 - 日志组件异常
This exception is thrown when errors occur during logging operations, such as provider initialization failures or configuration errors.
当日志操作期间发生错误时抛出此异常,如提供者初始化失败或配置错误。
Features | 主要功能:
- Base exception for logging component errors - 日志组件错误的基础异常
- Factory methods for common error scenarios - 常见错误场景的工厂方法
- Extends OpenException with LOG component code - 继承 OpenException,使用 LOG 组件代码
Usage Examples | 使用示例:
// Throw provider not found
throw OpenLogException.providerNotFound();
// Throw initialization failure
throw OpenLogException.initializationFailed(cause);
// Throw invalid config
throw OpenLogException.invalidConfig("level", "Invalid log level");
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
- Since:
- JDK 25, opencode-base-log V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenLogException(String message) Constructs a new exception with the specified message.OpenLogException(String message, Throwable cause) Constructs a new exception with the specified message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenLogExceptionadapterNotFound(String adapterType) Creates an adapter not found exception.static OpenLogExceptioninitializationFailed(Throwable cause) Creates an initialization failed exception.static OpenLogExceptioninvalidConfig(String configKey, String message) Creates an invalid configuration exception.static OpenLogExceptionCreates a provider not found exception.static OpenLogExceptionunsupportedOperation(String operation) Creates an unsupported operation exception.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
-
Constructor Details
-
OpenLogException
Constructs a new exception with the specified message. 使用指定消息构造新异常。- Parameters:
message- the detail message - 详细消息
-
OpenLogException
-
-
Method Details
-
providerNotFound
Creates a provider not found exception. 创建提供者未找到异常。- Returns:
- the exception - 异常
-
initializationFailed
Creates an initialization failed exception. 创建初始化失败异常。- Parameters:
cause- the cause - 原因- Returns:
- the exception - 异常
-
invalidConfig
Creates an invalid configuration exception. 创建无效配置异常。- Parameters:
configKey- the configuration key - 配置键message- the error message - 错误消息- Returns:
- the exception - 异常
-
adapterNotFound
Creates an adapter not found exception. 创建适配器未找到异常。- Parameters:
adapterType- the adapter type - 适配器类型- Returns:
- the exception - 异常
-
unsupportedOperation
Creates an unsupported operation exception. 创建不支持的操作异常。- Parameters:
operation- the operation - 操作- Returns:
- the exception - 异常
-