diff --git a/client/src/main.rs b/client/src/main.rs index 79801df..2b564da 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1,5 +1,6 @@ use crate::config::{ClientConfig, Profile}; use crate::task::run; +use common::strings::REGION_NOT_FOUND; use communicator::{ClientManager, Identity, TunnelEndpoint, TunnelListener, connect_tunnel}; use lazy_static::lazy_static; use log::{LevelFilter, error, info}; @@ -179,6 +180,9 @@ async fn main() -> anyhow::Result<()> { .await; } Err(error) => { + if error.to_string().contains(REGION_NOT_FOUND) { + return; + } error!("{}", error); } _ => {} diff --git a/common/src/lib.rs b/common/src/lib.rs index b0883b5..a1c0dbd 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,3 +1,4 @@ pub mod stream; pub mod updater; -pub mod http; \ No newline at end of file +pub mod http; +pub mod strings; \ No newline at end of file diff --git a/common/src/strings.rs b/common/src/strings.rs new file mode 100644 index 0000000..eb363a2 --- /dev/null +++ b/common/src/strings.rs @@ -0,0 +1 @@ +pub static REGION_NOT_FOUND: &str = "region not found"; diff --git a/server/src/router/sync.rs b/server/src/router/sync.rs index 9ddd297..28a47a8 100644 --- a/server/src/router/sync.rs +++ b/server/src/router/sync.rs @@ -1,14 +1,14 @@ use crate::{CONFIG, SESSION_STORE}; -use assets_updater::core::asset_execution::{ - should_download_bundle, AssetExecutionContext, -}; +use assets_updater::core::asset_execution::{AssetExecutionContext, should_download_bundle}; +use assets_updater::core::errors::RegionError; use assets_updater::core::regions::select_region; use bytes::Bytes; use common::http::SyncResponse; +use common::strings::REGION_NOT_FOUND; use common::updater::SyncContext; use communicator::http::{json_from_request, send, send_error}; -use h2::server::SendResponse; use h2::RecvStream; +use h2::server::SendResponse; use http::Request; pub async fn sync_route( @@ -24,6 +24,15 @@ pub async fn sync_route( let region = select_region(&CONFIG.updater_config, &sync_context.region); if let Err(error) = region { + if let RegionError::NotFound(_) = &error { + send( + send_response, + 500, + "text/plain", + format!("{}: {}", REGION_NOT_FOUND, error), + ); + return Ok(()); + } send_error(send_response, error.into()); return Ok(()); } @@ -52,4 +61,3 @@ pub async fn sync_route( Ok(()) } -