Error Types
KrishivError, Result, and error handling patterns.
KrishivError
KrishivError is the top-level error type returned by all public API methods. It is a non-exhaustive enum that aggregates errors from all Krishiv subsystems.
pub type Result<T> = std::result::Result<T, KrishivError>;
Key Variants
| Variant | Description |
|---|---|
Sql(SqlError) | SQL planning or execution error from krishiv-sql. |
Runtime(String) | Execution runtime error (coordinator, executor, or scheduler). |
Io(std::io::Error) | Filesystem or network I/O error. |
Arrow(ArrowError) | Apache Arrow schema or data error. |
Config(String) | Session configuration error (missing endpoint, invalid option). |
Udf(UdfError) | UDF registration or execution error. |
Cancelled | Operation cancelled by the caller. |
Timeout | Operation exceeded its configured timeout. |
AccessDenied(String) | Request blocked by auth or policy hook. |
Error Handling Patterns
use krishiv_api::{Session, KrishivError, Result};
async fn run() -> Result<()> {
let session = Session::embedded().await?;
match session.sql("SELECT bad syntax!!!").await {
Ok(df) => { df.show().await?; }
Err(KrishivError::Sql(e)) => {
eprintln!("SQL error: {e}");
}
Err(e) => return Err(e),
}
Ok(())
}
SqlError
See the SQL Error Codes page for the full list of SqlError variants and their SQLSTATE codes.