aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/ankiweb.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-19 21:21:00 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-19 21:21:00 -0700
commitba02ae7f8dca794032959c62f72603b2f7814e68 (patch)
treea62a1ac8ec72d590253970c7dc5ab90dda6adc1a /ext/bg/js/ankiweb.js
parent7618b8e90904e354f43d3447363e2c5a1f98d357 (diff)
Improved error handling
Diffstat (limited to 'ext/bg/js/ankiweb.js')
-rw-r--r--ext/bg/js/ankiweb.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/bg/js/ankiweb.js b/ext/bg/js/ankiweb.js
index bed605ec..41bf74bd 100644
--- a/ext/bg/js/ankiweb.js
+++ b/ext/bg/js/ankiweb.js
@@ -27,7 +27,7 @@ class AnkiWeb {
return this.retrieve().then(info => {
const model = info.models.find(m => m.name === note.modelName);
if (!model) {
- return Promise.reject('invalid model');
+ return Promise.reject('cannot add note model provided');
}
const fields = [];
@@ -110,7 +110,7 @@ class AnkiWeb {
static login(username, password) {
if (username.length === 0 || password.length === 0) {
- return Promise.reject('unspecified login credentials');
+ return Promise.reject('login credentials not specified');
}
const data = {username, password, submitted: 1};
@@ -143,7 +143,7 @@ class AnkiWeb {
}
const xhr = new XMLHttpRequest();
- xhr.addEventListener('error', () => reject('failed to execute request'));
+ xhr.addEventListener('error', () => reject('failed to execute network request'));
xhr.addEventListener('load', () => resolve(xhr.responseText));
xhr.open('GET', url);
xhr.send();