Display error when importing invalid YouTube JSON

Closes: #969

Apparently, every importing option had a proper error message
displayed on a toast... except this one.
Oops.
This commit is contained in:
Svallinn 2021-04-21 03:43:40 +01:00
parent 78324ff775
commit c4afaaaf06
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
1 changed files with 10 additions and 6 deletions

View File

@ -249,6 +249,10 @@ export default Vue.extend({
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0])) const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))
const subscriptions = [] const subscriptions = []
this.showToast({
message: this.$t('Settings.Data Settings.This might take a while, please wait')
})
this.updateShowProgressBar(true) this.updateShowProgressBar(true)
this.setProgressBarPercentage(0) this.setProgressBarPercentage(0)
@ -258,6 +262,11 @@ export default Vue.extend({
const snippet = channel.snippet const snippet = channel.snippet
if (typeof snippet === 'undefined') { if (typeof snippet === 'undefined') {
const message = this.$t('Settings.Data Settings.Invalid subscriptions file')
this.showToast({
message: message
})
throw new Error('Unable to find channel data') throw new Error('Unable to find channel data')
} }
@ -321,12 +330,7 @@ export default Vue.extend({
} }
const filePath = response.filePaths[0] const filePath = response.filePaths[0]
try {
this.handleYoutubeImportFile(filePath) this.handleYoutubeImportFile(filePath)
} catch (err) {
console.log(err)
}
}) })
}, },