Add atomic durable job admission

This commit is contained in:
ms2k 2026-07-17 03:20:57 +09:00
commit b3e63b9e2b

View 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()),
}
}
}