30 lines
897 B
Rust
30 lines
897 B
Rust
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()),
|
|
}
|
|
}
|
|
}
|