Skip to content

Revert "chore: add special error for II subnet downtime" #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/routing/error_cause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub enum ErrorCause {
CanisterIdNotResolved,
CanisterRouteNotFound,
SubnetNotFound,
SubnetUnavailable(String),
SubnetUnavailable,
NoRoutingTable,
ResponseVerificationError,
HttpGatewayError(String),
Expand Down Expand Up @@ -194,7 +194,7 @@ impl From<&BNResponseMetadata> for Option<ErrorCause> {
}

Some(match v.error_cause.as_ref() {
NO_HEALTHY_NODES => ErrorCause::SubnetUnavailable(v.subnet_id.clone()),
NO_HEALTHY_NODES => ErrorCause::SubnetUnavailable,
CANISTER_NOT_FOUND | CANISTER_ROUTE_NOT_FOUND => ErrorCause::CanisterRouteNotFound,
SUBNET_NOT_FOUND => ErrorCause::SubnetNotFound,
FORBIDDEN => ErrorCause::Forbidden,
Expand Down Expand Up @@ -270,7 +270,7 @@ pub enum ErrorClientFacing {
CanisterIdIncorrect,
SubnetNotFound,
#[strum(serialize = "subnet_updating")]
SubnetUnavailable(String),
SubnetUnavailable,
ResponseVerificationError,
Denylisted,
Forbidden,
Expand Down Expand Up @@ -298,7 +298,7 @@ impl ErrorClientFacing {
Self::CanisterIdNotResolved => StatusCode::BAD_REQUEST,
Self::CanisterIdIncorrect => StatusCode::BAD_REQUEST,
Self::SubnetNotFound => StatusCode::BAD_REQUEST,
Self::SubnetUnavailable(_) => StatusCode::SERVICE_UNAVAILABLE,
Self::SubnetUnavailable => StatusCode::SERVICE_UNAVAILABLE,
Self::ResponseVerificationError => StatusCode::SERVICE_UNAVAILABLE,
Self::Denylisted => StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS,
Self::Forbidden => StatusCode::FORBIDDEN,
Expand All @@ -325,7 +325,7 @@ impl ErrorClientFacing {
Self::CanisterIdNotResolved => "HTTP gateway wasn't able to resolve the ID of the canister where to send the request.".into(),
Self::CanisterIdIncorrect => "The canister ID is incorrect".into(),
Self::SubnetNotFound => "The requested subnet was not found.".into(),
Self::SubnetUnavailable(_) => "This part of the Internet Computer is currently upgrading. It should be back in a couple of minutes. No worries – your data is safe! Please try again later.".into(),
Self::SubnetUnavailable => "This part of the Internet Computer is currently upgrading. It should be back in a couple of minutes. No worries – your data is safe! Please try again later.".into(),
Self::ResponseVerificationError => "The response from the canister failed verification and cannot be trusted.\nIf you understand the risks, you can retry using the raw domain to bypass certification.".into(),
Self::Denylisted => "Access to this resource is denied due to a violation of the code of conduct.".into(),
Self::Forbidden => "Access to this resource is denied by the current set of application firewall rules.".into(),
Expand All @@ -345,11 +345,6 @@ impl ErrorClientFacing {
pub fn html(&self) -> String {
match self {
Self::Denylisted => include_str!("error_pages/451.html").to_string(),
Self::SubnetUnavailable(subnet)
if subnet == "uzr34-akd3s-xrdag-3ql62-ocgoh-ld2ao-tamcv-54e7j-krwgb-2gm4z-oqe" =>
{
include_str!("error_pages/identity.html").to_string()
}
_ => {
let template = ERROR_PAGE_TEMPLATE;
let template = template.replace("{status_code}", self.status_code().as_str());
Expand Down Expand Up @@ -381,7 +376,7 @@ impl From<&ErrorCause> for ErrorClientFacing {
ErrorCause::CanisterIdNotResolved => Self::CanisterIdNotResolved,
ErrorCause::CanisterIdIncorrect(_) => Self::CanisterIdIncorrect,
ErrorCause::SubnetNotFound => Self::SubnetNotFound,
ErrorCause::SubnetUnavailable(x) => Self::SubnetUnavailable(x.clone()),
ErrorCause::SubnetUnavailable => Self::SubnetUnavailable,
ErrorCause::ResponseVerificationError => Self::ResponseVerificationError,
ErrorCause::DomainCanisterMismatch => Self::DomainCanisterMismatch,
ErrorCause::Denylisted => Self::Denylisted,
Expand Down Expand Up @@ -446,10 +441,7 @@ mod test {

// Mapping of "error_cause" BN headers
let cases = [
(
NO_HEALTHY_NODES,
Some(ErrorCause::SubnetUnavailable("".into())),
),
(NO_HEALTHY_NODES, Some(ErrorCause::SubnetUnavailable)),
(NO_ROUTING_TABLE, Some(ErrorCause::NoRoutingTable)),
(FORBIDDEN, Some(ErrorCause::Forbidden)),
(LOAD_SHED, Some(ErrorCause::LoadShed)),
Expand Down
Loading