use pontifex::{ChannelError, attestation};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid {attribute}: {reason}")]
InvalidConfig {
attribute: String,
reason: String,
},
#[error("failed to parse config: {0}")]
MalformedConfig(String),
#[error(transparent)]
Attestation(#[from] attestation::Error),
#[error("assignment document or public key was not valid base64")]
MalformedAssignment,
#[error("the request was not sealed to the enclave's current key; re-assign and retry once")]
ReassignRequired,
#[error("sealed channel failure: {0:?}")]
Channel(#[source] ChannelError),
#[error("sealed response was not a match result")]
MalformedResult,
#[error("attested signing public key was invalid")]
InvalidSigningKey,
#[error("match statement did not verify under the attested signing key")]
StatementInvalid,
#[error("WebSocket transport failed: {0}")]
WebSocket(#[source] tokio_tungstenite::tungstenite::Error),
#[error("the host did not respond within the configured deadline")]
Timeout,
#[error("the host closed the connection before the exchange completed")]
ConnectionClosed,
#[error("the host sent an unexpected or malformed message")]
MalformedMessage,
#[error("host returned error ({code})")]
ApiFrame {
code: String,
allow_retry: bool,
},
}