Skip to content

Commit

Permalink
Print non crate Error for investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNorom committed Sep 16, 2023
1 parent ffa7dc3 commit 69ba1e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/banner_changer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ impl ChangerError {

dm_users(&ctx, owners.clone(), &message).await?;

match self.source.as_ref().downcast_ref::<crate::Error>().unwrap() {
let err = match self.source.downcast_ref::<crate::Error>() {
Some(err) => err,
None => {
error!("Recieved error that is not `crate::Error`: {}", self.source);
return Err(Error::Other(anyhow::anyhow!(self.source.to_string())));
}
};

match err {
Error::Serenity(error) => match error {
serenity_prelude::Error::Http(error) => match error.as_ref() {
serenity_prelude::HttpError::UnsuccessfulRequest(error_response) => {
Expand Down

0 comments on commit 69ba1e2

Please sign in to comment.