1use std::io;
2
3use prost::DecodeError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum HdfsError {
8 #[error("IO error occurred while communicating with HDFS: {0}")]
9 IOError(#[from] io::Error),
10 #[error("data transfer error: {0}")]
11 DataTransferError(String),
12 #[error("checksums didn't match")]
13 ChecksumError,
14 #[error("invalid path: {0}")]
15 InvalidPath(String),
16 #[error("invalid argument: {0}")]
17 InvalidArgument(String),
18 #[error("failed to parse URL: {0}")]
19 UrlParseError(#[from] url::ParseError),
20 #[error("file already exists: {0}")]
21 AlreadyExists(String),
22 #[error("operation failed: {0}")]
23 OperationFailed(String),
24 #[error("file not found: {0}")]
25 FileNotFound(String),
26 #[error("blocks not found for {0}")]
27 BlocksNotFound(String),
28 #[error("path is a directory: {0}")]
29 IsADirectoryError(String),
30 #[error("unsupported erasure coding policy {0}")]
31 UnsupportedErasureCodingPolicy(String),
32 #[error("erasure coding error: {0}")]
33 ErasureCodingError(String),
34 #[error("operation not supported: {0}")]
35 UnsupportedFeature(String),
36 #[error("interal error, this shouldn't happen: {0}")]
37 InternalError(String),
38 #[error("failed to decode RPC response: {0}")]
39 InvalidRPCResponse(#[from] DecodeError),
40 #[error("RPC error: {0} {1}")]
41 RPCError(String, String),
42 #[error("fatal RPC error: {0} {1}")]
43 FatalRPCError(String, String),
44 #[error("SASL error: {0}")]
45 SASLError(String),
46 #[error("GSSAPI error: {0:?} {1} {2}")]
47 GSSAPIError(crate::security::gssapi::GssMajorCodes, u32, String),
48 #[error("No valid SASL mechanism found")]
49 NoSASLMechanism,
50}
51
52pub type Result<T> = std::result::Result<T, HdfsError>;