25 lines
737 B
Rust
25 lines
737 B
Rust
|
|
use remora_durable::DurableError;
|
||
|
|
|
||
|
|
#[derive(Debug, thiserror::Error)]
|
||
|
|
pub enum DeletionError {
|
||
|
|
#[error("resource not found")]
|
||
|
|
NotFound,
|
||
|
|
#[error("job is not terminal")]
|
||
|
|
NotTerminal,
|
||
|
|
#[error("hard deletion has already started")]
|
||
|
|
HardDeleteStarted,
|
||
|
|
#[error("committed result inventory is corrupt")]
|
||
|
|
CorruptInventory,
|
||
|
|
#[error("deletion claim is no longer authoritative")]
|
||
|
|
ClaimLost,
|
||
|
|
#[error("invalid deletion configuration: {0}")]
|
||
|
|
InvalidConfig(String),
|
||
|
|
#[error("durable deletion operation failed: {0}")]
|
||
|
|
Durable(#[from] DurableError),
|
||
|
|
}
|
||
|
|
|
||
|
|
impl From<sqlx::Error> for DeletionError {
|
||
|
|
fn from(error: sqlx::Error) -> Self {
|
||
|
|
Self::Durable(DurableError::Database(error))
|
||
|
|
}
|
||
|
|
}
|