Log JSON parsing errors

This commit is contained in:
Alex Page 2023-03-18 02:40:07 -04:00
parent 22eba91a17
commit b2505ce086

View file

@ -91,7 +91,27 @@ pub async fn play(
let mut handler = handler_lock.lock().await;
debug!("Trying to play: {}", url);
let source = songbird::ytdl(&url).await?;
let source = songbird::ytdl(&url).await;
let source = match source {
Ok(source) => source,
Err(e) => {
match e {
songbird::input::error::Error::Json {
ref error,
ref parsed_text,
} => {
debug!("Failed to play: {}", error);
debug!("Parsed text: {}", parsed_text);
}
_ => {
debug!("Failed to play: {}", e);
}
}
return Err(Box::new(e));
}
};
debug!("Playing: {:?}", source.metadata);
let title = source
.metadata