Bump ver. Use Discord's error codes where possible to improve logging
This commit is contained in:
parent
a58b9866ea
commit
8d2232f0da
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2217,7 +2217,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reminder-rs"
|
name = "reminder-rs"
|
||||||
version = "1.6.24"
|
version = "1.6.25"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.2",
|
"base64 0.21.2",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder-rs"
|
name = "reminder-rs"
|
||||||
version = "1.6.24"
|
version = "1.6.25"
|
||||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0 only"
|
license = "AGPL-3.0 only"
|
||||||
|
@ -7,7 +7,7 @@ use regex::{Captures, Regex};
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serenity::{
|
use serenity::{
|
||||||
builder::CreateEmbed,
|
builder::CreateEmbed,
|
||||||
http::{CacheHttp, Http, HttpError, StatusCode},
|
http::{CacheHttp, Http, HttpError},
|
||||||
model::{
|
model::{
|
||||||
channel::{Channel, Embed as SerenityEmbed},
|
channel::{Channel, Embed as SerenityEmbed},
|
||||||
id::ChannelId,
|
id::ChannelId,
|
||||||
@ -591,23 +591,35 @@ WHERE
|
|||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
if let Error::Http(error) = e {
|
if let Error::Http(error) = e {
|
||||||
if error.status_code() == Some(StatusCode::NOT_FOUND) {
|
if let HttpError::UnsuccessfulRequest(http_error) = *error {
|
||||||
error!(
|
if http_error.error.code == 50007 {
|
||||||
"Reminder {} could not be sent as channel doesn't exist: {:?}",
|
|
||||||
self.id, e
|
|
||||||
);
|
|
||||||
self.force_delete(pool).await;
|
|
||||||
} else if let HttpError::UnsuccessfulRequest(error) = *error {
|
|
||||||
if error.error.code == 50007 {
|
|
||||||
error!(
|
error!(
|
||||||
"Reminder {} could not be sent as user has DMs disabled: {:?}",
|
"Reminder {} could not be sent as user has DMs disabled",
|
||||||
self.id, e
|
self.id
|
||||||
|
);
|
||||||
|
self.force_delete(pool).await;
|
||||||
|
} else if http_error.error.code == 10003 {
|
||||||
|
error!(
|
||||||
|
"Reminder {} could not be sent as channel does not exist",
|
||||||
|
self.id
|
||||||
|
);
|
||||||
|
self.force_delete(pool).await;
|
||||||
|
} else if http_error.error.code == 10004 {
|
||||||
|
error!(
|
||||||
|
"Reminder {} could not be sent as guild does not exist",
|
||||||
|
self.id
|
||||||
);
|
);
|
||||||
self.force_delete(pool).await;
|
self.force_delete(pool).await;
|
||||||
} else {
|
} else {
|
||||||
error!("HTTP Error sending reminder {}: {:?}", self.id, e);
|
error!("HTTP Error sending reminder {}: {:?}", self.id, http_error);
|
||||||
self.refresh(pool).await;
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
error!(
|
||||||
|
"(Likely) a parsing error when sending reminder {}: {:?}",
|
||||||
|
self.id, error
|
||||||
|
);
|
||||||
|
self.refresh(pool).await;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error!("Non-HTTP Error sending reminder {}: {:?}", self.id, e);
|
error!("Non-HTTP Error sending reminder {}: {:?}", self.id, e);
|
||||||
|
Loading…
Reference in New Issue
Block a user