diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a99d23..df9c471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Procedure when bumping the version number: ### Fixed - `!uptime` minute count +- Instance reconnecting after encountering a 404 (it now stops and logs an error) ## v0.3.0 - 2023-02-11 diff --git a/src/bot/instance.rs b/src/bot/instance.rs index c651bb9..668cc2c 100644 --- a/src/bot/instance.rs +++ b/src/bot/instance.rs @@ -11,7 +11,7 @@ use cookie::{Cookie, CookieJar}; use tokio::select; use tokio::sync::{mpsc, oneshot}; use tokio_tungstenite::tungstenite; -use tokio_tungstenite::tungstenite::http::HeaderValue; +use tokio_tungstenite::tungstenite::http::{HeaderValue, StatusCode}; use crate::api::packet::ParsedPacket; use crate::api::{Auth, AuthOption, Data, Nick}; @@ -364,6 +364,12 @@ impl Instance { idebug!(config, "Instance dropped"); break; } + Err(RunError::CouldNotConnect(tungstenite::Error::Http(response))) + if response.status() == StatusCode::NOT_FOUND => + { + iwarn!(config, "Failed to connect: room does not exist"); + break; + } Err(RunError::CouldNotConnect(err)) => { iwarn!(config, "Failed to connect: {err}"); false