Skip to content

Commit

Permalink
Fix Invidious API error toasts saying undefined (FreeTubeApp#5380)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored Jul 9, 2024
1 parent 187c00d commit 823e9bb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/Trending/Trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 823e9bb

Please sign in to comment.