-
-
Notifications
You must be signed in to change notification settings - Fork 1
Properly log song.link errors #24
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Properly log the errors coming from song.link, this includes modifications in the following locations:
Share-Music/src/util/odesli/mod.rs
Lines 89 to 91 in 406aefa
| if resp.status() != 200 { | |
| return Err(ApiErr::Non200Response(resp.status())); | |
| } |
Share-Music/src/handlers/interactions/common.rs
Lines 74 to 118 in 406aefa
| pub async fn map_odesli_response( | |
| resp: Result<OdesliResponse, ApiErr>, | |
| context: &Ctx, | |
| inter: &Interaction, | |
| ) -> EmptyResult<OdesliResponse> { | |
| match resp.warn_with("Failed to get the data from the api") { | |
| Some(s) => Ok(s), | |
| None => { | |
| if let Some(msg_resp) = context | |
| .interaction_client() | |
| .create_followup(inter.token.as_str()) | |
| .content(messages::error((&inter.locale).into())) | |
| .expect("Somehow the static string is too long, this should never happen") | |
| .into_future() | |
| .instrument(debug_span!("sending_error_message")) | |
| .await | |
| .warn_with("Failed to inform user of the error") | |
| { | |
| let msg = match msg_resp.model().await { | |
| Ok(ok) => ok, | |
| Err(_) => return Err(()), | |
| }; | |
| let ctx = context.clone(); | |
| tokio::spawn(async move { | |
| let _ = time::timeout( | |
| Duration::from_secs(15), | |
| create_termination_future(&ctx.state), | |
| ) | |
| .await; | |
| ctx.discord_client | |
| .delete_message(msg.channel_id, msg.id) | |
| .into_future() | |
| .instrument(debug_span!("deleting_error_message")) | |
| .await | |
| .warn_with("Failed to delete Error Message") | |
| }); | |
| } | |
| Err(()) | |
| } | |
| } | |
| } |
Note
song.link returns errors in the following format (not guaranteed, but observed thus far):
{
"statusCode": 400,
"code": "could_not_resolve_entity"
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request