Expand description
Errors that returned by OpenDAL
Examples
use anyhow::Result;
use opendal::ObjectMode;
use opendal::Operator;
use opendal::error::Kind;
use opendal::services::fs;
#[tokio::main]
async fn main() -> Result<()> {
let op = Operator::new(fs::Backend::build().root("/tmp").finish().await?);
// Get metadata of an object.
let meta = op.object("test_file").metadata().await;
if let Err(e) = op.object("test_file").metadata().await {
if e.kind() == Kind::ObjectNotExist {
println!("object not exist")
}
}
Ok(())
}
Enums
Error is the error type for the dal2 crate.
Kind is all meaningful error kind, that means you can depend on Kind
to
take some actions instead of just print. For example, you can try check
ObjectNotExist
before starting a write operation.