use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum DrainError {
#[error(
"unsupported destination scheme `{scheme}://` in `{uri}` — \
the log drain supports `s3://` and `file://` only"
)]
UnsupportedScheme {
scheme: String,
uri: String,
},
#[error("malformed destination URI `{uri}`: {reason}")]
Uri {
uri: String,
reason: String,
},
#[error("AWS credentials unavailable for `{uri}`: {source}")]
Credentials {
uri: String,
#[source]
source: Box<dyn std::error::Error + Send + Sync>,
},
#[error("object-store {op} failed for `{key}`: {source}")]
Transport {
op: &'static str,
key: String,
#[source]
source: object_store::Error,
},
#[error("io error at `{}`: {source}", path.display())]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("drain manifest at `{key}` is unreadable: {reason}")]
Manifest {
key: String,
reason: String,
},
#[error(
"refusing to upload: `{field}` is empty — \
the log drain never writes under an unknown identity"
)]
MissingIdentity {
field: &'static str,
},
}