deltalake_lakefs/
errors.rs1use deltalake_core::DeltaTableError;
4use deltalake_core::kernel::transaction::TransactionError;
5use reqwest::Error;
6
7#[derive(thiserror::Error, Debug)]
8pub enum LakeFSConfigError {
9 #[error("LakeFS endpoint is missing in storage options. Set `endpoint`.")]
11 EndpointMissing,
12
13 #[error("LakeFS username is missing in storage options. Set `access_key_id`.")]
15 UsernameCredentialMissing,
16
17 #[error("LakeFS password is missing in storage options. Set `secret_access_key`.")]
19 PasswordCredentialMissing,
20}
21
22#[derive(thiserror::Error, Debug)]
23pub enum LakeFSOperationError {
24 #[error("Failed to send request to LakeFS: {source}")]
26 HttpRequestFailed { source: Error },
27
28 #[error("LakeFS request was unauthorized. Check permissions.")]
30 UnauthorizedAction,
31
32 #[error("LakeFS commit failed. Reason: {0}")]
34 CommitFailed(String),
35
36 #[error("LakeFS merge failed. Reason: {0}")]
38 MergeFailed(String),
39
40 #[error("LakeFS create branch failed. Reason: {0}")]
42 CreateBranchFailed(String),
43
44 #[error("LakeFS delete branch failed. Reason: {0}")]
46 DeleteBranchFailed(String),
47
48 #[error("Transaction ID ({0}) not found. Something went wrong.")]
50 TransactionIdNotFound(String),
51}
52
53impl From<LakeFSOperationError> for TransactionError {
54 fn from(err: LakeFSOperationError) -> Self {
55 TransactionError::LogStoreError {
56 msg: err.to_string(),
57 source: Box::new(err),
58 }
59 }
60}
61
62impl From<LakeFSOperationError> for DeltaTableError {
63 fn from(err: LakeFSOperationError) -> Self {
64 DeltaTableError::Transaction {
65 source: TransactionError::LogStoreError {
66 msg: err.to_string(),
67 source: Box::new(err),
68 },
69 }
70 }
71}
72
73impl From<LakeFSConfigError> for DeltaTableError {
74 fn from(err: LakeFSConfigError) -> Self {
75 DeltaTableError::GenericError {
76 source: Box::new(err),
77 }
78 }
79}