use reqwest::StatusCode;
#[derive(Debug, thiserror::Error)]
pub enum FunctionsError {
#[error(
"invalid function name {0:?}: it must be non-empty, must not be '.' or '..', and must not contain '/', tab, CR, or LF"
)]
InvalidFunctionName(String),
#[error("invalid project URL: {0}")]
Url(#[from] url::ParseError),
#[error("project URL cannot be a base URL")]
UrlNotBase,
#[error("invalid header name: {0}")]
HeaderName(#[from] reqwest::header::InvalidHeaderName),
#[error("invalid header value: {0}")]
HeaderValue(#[from] reqwest::header::InvalidHeaderValue),
#[error("failed to serialize request body: {0}")]
Serialize(#[source] serde_json::Error),
#[error("transport error: {0}")]
Transport(#[from] reqwest::Error),
#[error("relay error {status}: {body}")]
Relay {
status: StatusCode,
body: String,
},
#[error("function returned {status}: {body}")]
Http {
status: StatusCode,
body: String,
},
#[error("failed to decode response body: {0}")]
Decode(#[source] serde_json::Error),
}