Don't reconnect when encountering 404

This commit is contained in:
Joscha 2023-02-17 17:03:14 +01:00
parent 319de09c35
commit be9d43f8cc
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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