From 42046a00de23e8e75e851a704f461a26abf870c4 Mon Sep 17 00:00:00 2001 From: Preston Date: Mon, 1 Jun 2020 22:46:11 -0400 Subject: [PATCH] Add Error handling for search suggestions --- src/renderer/components/top-nav/top-nav.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index 27609dc2..ba1eaf58 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -127,6 +127,12 @@ export default Vue.extend({ ytSuggest(query).then((results) => { this.searchSuggestionsDataList = results this.searchValue = query + }).error((err) => { + console.log(err) + if (this.backendFallback) { + console.log('Error gettings search suggestions. Falling back to Invidious API') + this.getSearchSuggestionsInvidious(query) + } }) }, @@ -148,6 +154,12 @@ export default Vue.extend({ this.$store.dispatch('invidiousAPICall', searchPayload).then((results) => { this.searchSuggestionsDataList = results.suggestions this.searchValue = query + }).error((err) => { + console.log(err) + if (this.backendFallback) { + console.log('Error gettings search suggestions. Falling back to Local API') + this.getSearchSuggestionsLocal(query) + } }) },