From bc9a12ac4e560ab46e34692f743bce52c20d143d Mon Sep 17 00:00:00 2001 From: Brandt Hill Date: Wed, 14 Aug 2024 19:50:55 -0500 Subject: [PATCH 1/2] Rescue async voice listening from mystery meat packets --- lib/nostrum/voice/session.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/nostrum/voice/session.ex b/lib/nostrum/voice/session.ex index 0a2ecf2d4..cdaf267ad 100644 --- a/lib/nostrum/voice/session.ex +++ b/lib/nostrum/voice/session.ex @@ -154,6 +154,13 @@ defmodule Nostrum.Voice.Session do end {:noreply, state} + rescue + _error -> + Logger.warning( + "Received bad voice packet in guild_id #{state.guild_id}: #{inspect(packet)}" + ) + + {:noreply, state} end def handle_cast(:heartbeat, %{heartbeat_ack: false, heartbeat_ref: timer_ref} = state) do From 8004efd68b4a1e01d18f6a5394e750d3aad4ff0e Mon Sep 17 00:00:00 2001 From: Brandt Hill Date: Tue, 20 Aug 2024 13:37:46 -0500 Subject: [PATCH 2/2] Inspect error when bad voice packet is received --- lib/nostrum/voice/session.ex | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/nostrum/voice/session.ex b/lib/nostrum/voice/session.ex index cdaf267ad..1289d7a16 100644 --- a/lib/nostrum/voice/session.ex +++ b/lib/nostrum/voice/session.ex @@ -155,10 +155,8 @@ defmodule Nostrum.Voice.Session do {:noreply, state} rescue - _error -> - Logger.warning( - "Received bad voice packet in guild_id #{state.guild_id}: #{inspect(packet)}" - ) + error -> + Logger.warning("Received bad voice packet in guild_id #{state.guild_id}: #{inspect(error)}") {:noreply, state} end