From 315d94acfea6fd81814e8438ad0659a6d0156566 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Fri, 18 Jun 2021 00:29:37 +0545 Subject: [PATCH] catch stream errors --- src/Structures/Queue.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index e586324..d27a00d 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -243,7 +243,7 @@ class Queue { fmt: "s16le", encoderArgs: options.encoderArgs ?? [], seek: options.seek - }); + }).on("error", (err) => this.player.emit("error", this, err)); } else { stream = ytdl.arbitraryStream( track.raw.source === "soundcloud" ? await track.raw.engine.downloadProgressive() : typeof track.raw.engine === "function" ? await track.raw.engine() : track.raw.engine, @@ -253,7 +253,7 @@ class Queue { encoderArgs: options.encoderArgs ?? [], seek: options.seek } - ); + ).on("error", (err) => this.player.emit("error", this, err)); } const resource: AudioResource = this.connection.createStream(stream, {