From 349df95d7ee38f3896f734fa4ac78ef1c5166ed6 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 30 May 2018 11:32:54 +0200 Subject: [PATCH] MOBILE-2354: Fix missing Promise.reject when using createFakeWSError --- src/addon/messages/providers/messages.ts | 2 +- src/addon/mod/feedback/providers/feedback.ts | 2 +- src/addon/mod/forum/providers/forum.ts | 4 ++-- src/addon/mod/glossary/providers/glossary.ts | 2 +- src/addon/mod/survey/providers/survey.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/addon/messages/providers/messages.ts b/src/addon/messages/providers/messages.ts index 19ece296b..4957047d4 100644 --- a/src/addon/messages/providers/messages.ts +++ b/src/addon/messages/providers/messages.ts @@ -1033,7 +1033,7 @@ export class AddonMessagesProvider { return this.sendMessagesOnline(messages, siteId).then((response) => { if (response && response[0] && response[0].msgid === -1) { // There was an error, and it should be translated already. - return this.utils.createFakeWSError(response[0].errormessage); + return Promise.reject(this.utils.createFakeWSError(response[0].errormessage)); } return this.invalidateDiscussionCache(toUserId, siteId).catch(() => { diff --git a/src/addon/mod/feedback/providers/feedback.ts b/src/addon/mod/feedback/providers/feedback.ts index c28d69193..3fcb0099e 100644 --- a/src/addon/mod/feedback/providers/feedback.ts +++ b/src/addon/mod/feedback/providers/feedback.ts @@ -1189,7 +1189,7 @@ export class AddonModFeedbackProvider { }; return site.write('mod_feedback_process_page', params).catch((error) => { - return this.utils.createFakeWSError(error); + return Promise.reject(this.utils.createFakeWSError(error)); }).then((response) => { // Invalidate and update current values because they will change. return this.invalidateCurrentValuesData(feedbackId, site.getId()).then(() => { diff --git a/src/addon/mod/forum/providers/forum.ts b/src/addon/mod/forum/providers/forum.ts index 37f36b139..cdbe517d3 100644 --- a/src/addon/mod/forum/providers/forum.ts +++ b/src/addon/mod/forum/providers/forum.ts @@ -179,7 +179,7 @@ export class AddonModForumProvider { return site.write('mod_forum_add_discussion', params).then((response) => { // Other errors ocurring. if (!response || !response.discussionid) { - return this.utils.createFakeWSError(''); + return Promise.reject(this.utils.createFakeWSError('')); } else { return response.discussionid; } @@ -694,7 +694,7 @@ export class AddonModForumProvider { return site.write('mod_forum_add_discussion_post', params).then((response) => { if (!response || !response.postid) { - return this.utils.createFakeWSError(''); + return Promise.reject(this.utils.createFakeWSError('')); } else { return response.postid; } diff --git a/src/addon/mod/glossary/providers/glossary.ts b/src/addon/mod/glossary/providers/glossary.ts index 943e91532..990f33cdd 100644 --- a/src/addon/mod/glossary/providers/glossary.ts +++ b/src/addon/mod/glossary/providers/glossary.ts @@ -812,7 +812,7 @@ export class AddonModGlossaryProvider { return response.entryid; } - return this.utils.createFakeWSError(''); + return Promise.reject(this.utils.createFakeWSError('')); }); }); } diff --git a/src/addon/mod/survey/providers/survey.ts b/src/addon/mod/survey/providers/survey.ts index 70c92dd03..a7ae0337d 100644 --- a/src/addon/mod/survey/providers/survey.ts +++ b/src/addon/mod/survey/providers/survey.ts @@ -268,7 +268,7 @@ export class AddonModSurveyProvider { return site.write('mod_survey_submit_answers', params).then((response) => { if (!response.status) { - return this.utils.createFakeWSError(''); + return Promise.reject(this.utils.createFakeWSError('')); } }); });