From a19511de24bb82007aab072844efe64bbb8698da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8A=88=EB=A6=AC=ED=8A=AC?= <9804cjh@naver.com> Date: Sat, 29 Jun 2024 04:45:39 +0900 Subject: [PATCH] fix(FormatUtils): Throw an error if download requests fails --- src/utils/FormatUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/FormatUtils.ts b/src/utils/FormatUtils.ts index 4029131c..2c849c5c 100644 --- a/src/utils/FormatUtils.ts +++ b/src/utils/FormatUtils.ts @@ -90,6 +90,10 @@ export async function download( signal: cancel.signal }); + // Throw if the response is not 2xx + if (!response.ok) + throw new InnertubeError('The server responded with a non 2xx status code', { error_type: 'FETCH_FAILED', response }); + const body = response.body; if (!body)