Class OpenYmlException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.yml.exception.OpenYmlException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
YmlBindException, YmlParseException, YmlPathException, YmlPlaceholderException, YmlSecurityException
Open YAML Exception - Base exception for YAML operations
YAML 异常基类 - YAML 操作的基础异常
This is the base class for all YAML-related exceptions in this module.
这是本模块中所有 YAML 相关异常的基类。
Features | 主要功能:
- Line and column location tracking for parse errors - 解析错误的行列位置跟踪
- Base class for all YAML exceptions (parse, bind, path, security) - 所有 YAML 异常的基类
Usage Examples | 使用示例:
try {
OpenYml.parse(invalidYaml);
} catch (OpenYmlException e) {
if (e.hasLocation()) {
System.err.println("Error at line " + e.getLine());
}
}
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构建后不可变)
- Null-safe: No (message may be null) - 空值安全: 否(消息可能为空)
- Since:
- JDK 25, opencode-base-yml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenYmlException(String message) Constructs an exception with message.OpenYmlException(String message, int line, int column) Constructs an exception with message and location.OpenYmlException(String message, Throwable cause) Constructs an exception with message and cause.OpenYmlException(String message, Throwable cause, int line, int column) Constructs an exception with message, cause and location. -
Method Summary
Modifier and TypeMethodDescriptionintGets the column number where the error occurred.intgetLine()Gets the line number where the error occurred.booleanChecks if location information is available.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OpenYmlException
Constructs an exception with message. 构造带消息的异常。- Parameters:
message- the detail message | 详细消息
-
OpenYmlException
Constructs an exception with message and location. 构造带消息和位置的异常。- Parameters:
message- the detail message | 详细消息line- the line number | 行号column- the column number | 列号
-
OpenYmlException
-
OpenYmlException
-
-
Method Details
-
getLine
public int getLine()Gets the line number where the error occurred. 获取错误发生的行号。- Returns:
- the line number, or -1 if unknown | 行号,如果未知则返回 -1
-
getColumn
public int getColumn()Gets the column number where the error occurred. 获取错误发生的列号。- Returns:
- the column number, or -1 if unknown | 列号,如果未知则返回 -1
-
hasLocation
public boolean hasLocation()Checks if location information is available. 检查位置信息是否可用。- Returns:
- true if location is available | 如果位置可用则返回 true
-