Add atomic durable job admission
This commit is contained in:
parent
be651d559c
commit
b3e63b9e2b
1 changed files with 1129 additions and 0 deletions
30
crates/remora-admission/src/error.rs
Normal file
30
crates/remora-admission/src/error.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use remora_credentials::CredentialError;
|
||||
use remora_durable::DurableError;
|
||||
use remora_identity::IdentityError;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum AdmissionError {
|
||||
#[error("invalid submission: {0}")]
|
||||
Invalid(String),
|
||||
#[error("submission is not authorized")]
|
||||
Unauthorized,
|
||||
#[error("idempotency key was reused with a different request")]
|
||||
IdempotencyConflict,
|
||||
#[error("execution grant not found")]
|
||||
GrantNotFound,
|
||||
#[error("configuration error: {0}")]
|
||||
Config(String),
|
||||
#[error(transparent)]
|
||||
Credential(#[from] CredentialError),
|
||||
#[error(transparent)]
|
||||
Durable(#[from] DurableError),
|
||||
}
|
||||
|
||||
impl From<IdentityError> for AdmissionError {
|
||||
fn from(error: IdentityError) -> Self {
|
||||
match error {
|
||||
IdentityError::UnauthorizedTarget => Self::Unauthorized,
|
||||
other => Self::Invalid(other.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue