datafusion_objectstore_s3/error.rs
1//! Custom error type for `DataFusion-ObjectStore-S3`
2
3use std::error::Error;
4use std::fmt::{Display, Formatter};
5
6/// Enum with all errors in this crate.
7/// PartialEq is to enable testing for specific error types
8#[derive(Debug, PartialEq)]
9pub enum S3Error {
10 /// Returned when functionaly is not yet available.
11 NotImplemented(String),
12 /// Wrapper for AWS errors
13 AWS(String),
14}
15
16impl Display for S3Error {
17 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18 match self {
19 S3Error::NotImplemented(desc) => write!(f, "Not yet implemented: {}", desc),
20 S3Error::AWS(desc) => write!(f, "AWS error: {}", desc),
21 }
22 }
23}
24
25impl Error for S3Error {}