fix: return immediately on non-200

This commit is contained in:
DarkCat09 2024-11-27 18:39:25 +04:00
parent 04bfa2c1ae
commit 2c9baa16df
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

View file

@ -94,6 +94,7 @@ async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> {
]) ])
.send() .send()
.await? .await?
.error_for_status()?
.json::<TgResponse>() .json::<TgResponse>()
.await? .await?
.result; .result;
@ -112,6 +113,7 @@ async fn handler(cfg: &Config, s: &mut State) -> Result<(), reqwest::Error> {
{ {
let mut args = text.split_whitespace(); let mut args = text.split_whitespace();
args.next(); // skip command name args.next(); // skip command name
match args.next()? { match args.next()? {
"ru" => { "ru" => {
let comic_id = args.next()?.parse::<u16>().ok()?; let comic_id = args.next()?.parse::<u16>().ok()?;