From 7c42254ff9bc8576d8aee41278d34b8fbfde749e Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:42:21 +0200 Subject: [PATCH] Fix Invidious API error toasts saying undefined --- .../components/subscriptions-live/subscriptions-live.js | 4 ++-- .../subscriptions-videos/subscriptions-videos.js | 4 ++-- .../watch-video-comments/watch-video-comments.js | 8 ++++---- src/renderer/views/Trending/Trending.js | 4 ++-- src/renderer/views/Watch/Watch.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/subscriptions-live/subscriptions-live.js b/src/renderer/components/subscriptions-live/subscriptions-live.js index 808270ad8ad0f..f556559f55d05 100644 --- a/src/renderer/components/subscriptions-live/subscriptions-live.js +++ b/src/renderer/components/subscriptions-live/subscriptions-live.js @@ -323,8 +323,8 @@ export default defineComponent({ }).catch((err) => { console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') - showToast(`${errorMessage}: ${err.responseText}`, 10000, () => { - copyToClipboard(err.responseText) + showToast(`${errorMessage}: ${err}`, 10000, () => { + copyToClipboard(err) }) switch (failedAttempts) { case 0: diff --git a/src/renderer/components/subscriptions-videos/subscriptions-videos.js b/src/renderer/components/subscriptions-videos/subscriptions-videos.js index b803f2724166c..e728668537665 100644 --- a/src/renderer/components/subscriptions-videos/subscriptions-videos.js +++ b/src/renderer/components/subscriptions-videos/subscriptions-videos.js @@ -324,8 +324,8 @@ export default defineComponent({ }).catch((err) => { console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') - showToast(`${errorMessage}: ${err.responseText}`, 10000, () => { - copyToClipboard(err.responseText) + showToast(`${errorMessage}: ${err}`, 10000, () => { + copyToClipboard(err) }) switch (failedAttempts) { case 0: diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index da34453b10919..1e3f18dce04f7 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -366,11 +366,11 @@ export default defineComponent({ } this.isLoading = false - }).catch((xhr) => { - console.error(xhr) + }).catch((error) => { + console.error(error) const errorMessage = this.$t('Invidious API Error (Click to copy)') - showToast(`${errorMessage}: ${xhr.responseText}`, 10000, () => { - copyToClipboard(xhr.responseText) + showToast(`${errorMessage}: ${error}`, 10000, () => { + copyToClipboard(error) }) this.isLoading = false }) diff --git a/src/renderer/views/Trending/Trending.js b/src/renderer/views/Trending/Trending.js index c4b9e65beb09a..1fe5e0d0fbb6c 100644 --- a/src/renderer/views/Trending/Trending.js +++ b/src/renderer/views/Trending/Trending.js @@ -164,8 +164,8 @@ export default defineComponent({ }).catch((err) => { console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') - showToast(`${errorMessage}: ${err.responseText}`, 10000, () => { - copyToClipboard(err.responseText) + showToast(`${errorMessage}: ${err}`, 10000, () => { + copyToClipboard(err) }) if (process.env.SUPPORTS_LOCAL_API && (this.backendPreference === 'invidious' && this.backendFallback)) { diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index b696da3f5f838..37799bf07a751 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -908,8 +908,8 @@ export default defineComponent({ .catch(err => { console.error(err) const errorMessage = this.$t('Invidious API Error (Click to copy)') - showToast(`${errorMessage}: ${err.responseText}`, 10000, () => { - copyToClipboard(err.responseText) + showToast(`${errorMessage}: ${err}`, 10000, () => { + copyToClipboard(err) }) console.error(err) if (process.env.SUPPORTS_LOCAL_API && this.backendPreference === 'invidious' && this.backendFallback) {