Phuedx has uploaded a new change for review.
https://gerrit.wikimedia.org/r/150783
Change subject: WIP Make the post-edit notification handle API errors
......................................................................
WIP Make the post-edit notification handle API errors
If the Suggestions API fails (the promise is rejected), then don't try
to display a suggestion. Instead, display a helpful error message.
TODO
* Write a helpful error message
Change-Id: Ibc93fa751093727ecdfed02a7af70c4efd58e6bd
---
M resources/lightbulb/lightbulb.postEdit.js
1 file changed, 6 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted
refs/changes/83/150783/1
diff --git a/resources/lightbulb/lightbulb.postEdit.js
b/resources/lightbulb/lightbulb.postEdit.js
index e0d1e48..5de4538 100644
--- a/resources/lightbulb/lightbulb.postEdit.js
+++ b/resources/lightbulb/lightbulb.postEdit.js
@@ -86,11 +86,14 @@
thumbSize: 70
} );
- suggestionsPromise.done( function ( response ) {
- var suggestions,
+ suggestionsPromise.always( function ( response ) {
+ var suggestions = [],
$notification;
- suggestions = parser.parse( response );
+ if ( suggestionsPromise.state() === "resolved" ) {
+ suggestions = parser.parse( response );
+ }
+
$notification = createNotification( suggestions,
data.message );
// Show the notification.
--
To view, visit https://gerrit.wikimedia.org/r/150783
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc93fa751093727ecdfed02a7af70c4efd58e6bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits