mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 02:52:12 +00:00
This is a fresh start for the `artcraft` repo. The old monorepo, which included our web API gateway, job services, SRE tools, various frontends, and more has moved to `artcraft-services` You can find the full git history here: https://github.com/storytold/artcraft-services This change was motivated by the fact that the entire git history was hundreds of gigabytes in size, which is unwieldy for anyone not in the core team that doesn't care about support services outside of the core artcraft app. We wanted to keep this repo in its well-known place since we already have users and activity here. Please update your remotes to either `artcraft-services` or make a fresh clone of this repo. History can be found at the artcraft-services repo.
46 lines
1.5 KiB
Rust
46 lines
1.5 KiB
Rust
use std::error::Error;
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
#[derive(Debug)]
|
|
pub enum CloudflareError {
|
|
/// Cloudflare returned a 301 Moved Permanently response.
|
|
/// TODO: This needs to include "location" and "set-cookie" headers.
|
|
MovedPermanently301,
|
|
|
|
/// Cloudflare wants to verify the request with a CAPTCHA challenge.
|
|
ChallengeInterstitial403,
|
|
|
|
/// Cloudflare returned a 502 Bad Gateway response.
|
|
BadGateway502,
|
|
|
|
/// Cloudflare could not form a connection to the backend server.
|
|
GatewayTimeout504,
|
|
|
|
/// Cloudflare formed a TCP connection to the backend server, but no payload was delivered before timeout
|
|
TimeoutOccurred524,
|
|
}
|
|
|
|
impl Error for CloudflareError {}
|
|
|
|
impl Display for CloudflareError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
Self::MovedPermanently301 => {
|
|
write!(f, "Cloudflare Moved Permanently (301)")
|
|
}
|
|
Self::ChallengeInterstitial403 => {
|
|
write!(f, "Cloudflare Challenge Interstitial (403); Cloudflare wants to verify the request with a CAPTCHA challenge.")
|
|
}
|
|
Self::BadGateway502 => {
|
|
write!(f, "Cloudflare Bad Gateway (502); This is likely a backend server issue.")
|
|
}
|
|
Self::GatewayTimeout504 => {
|
|
write!(f, "Cloudflare Gateway Timeout (504); This is likely a backend server issue.")
|
|
}
|
|
Self::TimeoutOccurred524 => {
|
|
write!(f, "Cloudflare Timeout (524); This is likely a backend server issue. Cloudflare connected, but did not receive a response from the server in time.")
|
|
}
|
|
}
|
|
}
|
|
}
|