diff options
Diffstat (limited to 'ext/js/media')
-rw-r--r-- | ext/js/media/audio-downloader.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/js/media/audio-downloader.js b/ext/js/media/audio-downloader.js index c2e1742f..0991d14d 100644 --- a/ext/js/media/audio-downloader.js +++ b/ext/js/media/audio-downloader.js @@ -51,6 +51,7 @@ class AudioDownloader { } async downloadTermAudio(sources, preferredAudioIndex, term, reading) { + const errors = []; for (const source of sources) { let infoList = await this.getTermAudioInfoList(source, term, reading); if (typeof preferredAudioIndex === 'number') { @@ -62,14 +63,16 @@ class AudioDownloader { try { return await this._downloadAudioFromUrl(info.url, source.type); } catch (e) { - // NOP + errors.push(e); } break; } } } - throw new Error('Could not download audio'); + const error = new Error('Could not download audio'); + error.data = {errors}; + throw error; } // Private |