Class OpenCsvException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.csv.exception.OpenCsvException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
- Direct Known Subclasses:
CsvBindException, CsvParseException, CsvWriteException
CSV Exception - Base exception for all CSV operations
CSV异常 - 所有CSV操作的基础异常
Thrown when CSV parsing, writing, binding, or I/O operations fail.
Extends OpenException to maintain consistent exception hierarchy.
Carries location information (line and column) for precise error reporting.
当CSV解析、写入、绑定或I/O操作失败时抛出。
继承 OpenException 以保持一致的异常体系。
携带位置信息(行和列)用于精确错误报告。
Features | 主要功能:
- Extends OpenException for unified hierarchy - 继承OpenException统一异常体系
- Line and column location tracking - 行和列位置跟踪
- Factory methods for common error types - 常见错误类型的工厂方法
- Serializable - 可序列化
Usage Examples | 使用示例:
throw OpenCsvException.parseError("Unclosed quote", 5, 23);
throw OpenCsvException.writeError("Failed to write CSV", cause);
throw OpenCsvException.bindError("Cannot bind to target", cause);
throw OpenCsvException.ioError("File not found", cause);
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-csv V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenCsvException(String message) Constructs exception with message 构造带消息的异常OpenCsvException(String message, int line, int column) Constructs exception with message and location 构造带消息和位置的异常OpenCsvException(String message, int line, int column, Throwable cause) Constructs exception with all diagnostic fields 构造带所有诊断字段的异常OpenCsvException(String message, Throwable cause) Constructs exception with message and cause 构造带消息和原因的异常 -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenCsvExceptionCreates exception for bind errors 为绑定错误创建异常intGets the column number where the error occurred 获取错误发生的列号intgetLine()Gets the line number where the error occurred 获取错误发生的行号booleanChecks if column location is available 检查列位置是否可用booleanChecks if line location is available 检查行位置是否可用static OpenCsvExceptionCreates exception for I/O errors 为I/O错误创建异常static OpenCsvExceptionparseError(String message, int line, int column) Creates exception for parse errors 为解析错误创建异常static OpenCsvExceptionwriteError(String message, Throwable cause) Creates exception for write errors 为写入错误创建异常Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
OpenCsvException
Constructs exception with message 构造带消息的异常- Parameters:
message- the detail message | 详细消息
-
OpenCsvException
-
OpenCsvException
Constructs exception with message and location 构造带消息和位置的异常- Parameters:
message- the detail message | 详细消息line- the line number (-1 if unknown) | 行号(-1表示未知)column- the column number (-1 if unknown) | 列号(-1表示未知)
-
OpenCsvException
Constructs exception with all diagnostic fields 构造带所有诊断字段的异常- Parameters:
message- the detail message | 详细消息line- the line number (-1 if unknown) | 行号(-1表示未知)column- the column number (-1 if unknown) | 列号(-1表示未知)cause- the cause | 原因
-
-
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
-
hasLineInfo
public boolean hasLineInfo()Checks if line location is available 检查行位置是否可用- Returns:
- true if line is known | 如果行号已知返回true
-
hasColumnInfo
public boolean hasColumnInfo()Checks if column location is available 检查列位置是否可用- Returns:
- true if column is known | 如果列号已知返回true
-
parseError
Creates exception for parse errors 为解析错误创建异常- Parameters:
message- the error message | 错误消息line- the line number | 行号column- the column number | 列号- Returns:
- the exception | 异常
-
writeError
Creates exception for write errors 为写入错误创建异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因- Returns:
- the exception | 异常
-
bindError
Creates exception for bind errors 为绑定错误创建异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因- Returns:
- the exception | 异常
-
ioError
Creates exception for I/O errors 为I/O错误创建异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因- Returns:
- the exception | 异常
-