summaryrefslogtreecommitdiff
path: root/ext/bg/js/audio.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-07 21:04:58 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-08 21:44:25 -0400
commit6a6e200ef947b92576351e39fc30b6653a576d70 (patch)
treeebe6bce781d597eb04dbea85395d9795409897d0 /ext/bg/js/audio.js
parent88de4271843197d37243a9ac360236f9dfb414e1 (diff)
Update rejections to use Error
Diffstat (limited to 'ext/bg/js/audio.js')
-rw-r--r--ext/bg/js/audio.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 2e5db7cc..44da51d1 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -57,7 +57,7 @@ async function audioBuildUrl(definition, mode, cache={}) {
const xhr = new XMLHttpRequest();
xhr.open('POST', 'https://www.japanesepod101.com/learningcenter/reference/dictionary_post');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.addEventListener('error', () => reject('Failed to scrape audio data'));
+ xhr.addEventListener('error', () => reject(new Error('Failed to scrape audio data')));
xhr.addEventListener('load', () => {
cache[definition.expression] = xhr.responseText;
resolve(xhr.responseText);
@@ -87,7 +87,7 @@ async function audioBuildUrl(definition, mode, cache={}) {
} else {
const xhr = new XMLHttpRequest();
xhr.open('GET', `https://jisho.org/search/${definition.expression}`);
- xhr.addEventListener('error', () => reject('Failed to scrape audio data'));
+ xhr.addEventListener('error', () => reject(new Error('Failed to scrape audio data')));
xhr.addEventListener('load', () => {
cache[definition.expression] = xhr.responseText;
resolve(xhr.responseText);