Skip to content

Commit

Permalink
expose more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GhenadieVP committed Jan 19, 2025
1 parent a9c1c1e commit 878dfe9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions crates/uniffi/uniffi_SPLIT_ME/src/core/error/common_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ pub enum CommonError {
NotPermissionToAccessFile {
path: String,
},
ReservedInstructionsNotAllowedInManifest {
reserved_instructions: String,
},
OneOfReceivingAccountsDoesNotAllowDeposits,
FailedTransactionPreview {
error_message: String,
},
FailedToExtractTransactionReceiptBytes,
MaxTransfersPerTransactionReached { amount: u64 },
}

#[uniffi::export]
Expand Down Expand Up @@ -250,6 +259,27 @@ impl CommonError {
path: path.clone(),
}
}
CommonError::ReservedInstructionsNotAllowedInManifest {
reserved_instructions,
} => {
InternalCommonError::ReservedInstructionsNotAllowedInManifest {
reserved_instructions: reserved_instructions.clone(),
}
}
CommonError::OneOfReceivingAccountsDoesNotAllowDeposits => {
InternalCommonError::OneOfReceivingAccountsDoesNotAllowDeposits
}
CommonError::FailedTransactionPreview { error_message } => {
InternalCommonError::FailedTransactionPreview {
error_message: error_message.clone(),
}
}
CommonError::FailedToExtractTransactionReceiptBytes => {
InternalCommonError::FailedToExtractTransactionReceiptBytes
}
CommonError::MaxTransfersPerTransactionReached { amount } => {
InternalCommonError::MaxTransfersPerTransactionReached { amount: *amount }
}
_ => InternalCommonError::Unknown,
}
}
Expand Down Expand Up @@ -349,6 +379,23 @@ impl From<InternalCommonError> for CommonError {
InternalCommonError::NotPermissionToAccessFile { path } => {
CommonError::NotPermissionToAccessFile { path }
}
InternalCommonError::ReservedInstructionsNotAllowedInManifest {
reserved_instructions,
} => CommonError::ReservedInstructionsNotAllowedInManifest {
reserved_instructions,
},
InternalCommonError::OneOfReceivingAccountsDoesNotAllowDeposits => {
CommonError::OneOfReceivingAccountsDoesNotAllowDeposits
}
InternalCommonError::FailedTransactionPreview { error_message } => {
CommonError::FailedTransactionPreview { error_message }
}
InternalCommonError::FailedToExtractTransactionReceiptBytes => {
CommonError::FailedToExtractTransactionReceiptBytes
}
InternalCommonError::MaxTransfersPerTransactionReached { amount } => {
CommonError::MaxTransfersPerTransactionReached { amount }
}
_ => CommonError::erased(value),
}
}
Expand Down

0 comments on commit 878dfe9

Please sign in to comment.