Show network and server errors in a toast 🍞 notification

gr-error-manager is introduced to deal with error events
fired from gr-rest-api-interface. Currently it will display
the first error it sees for 5 seconds, ignoring others during
that time. If a response comes back as a 403, it prompts the
user to refresh the page and the alert remains on the screen
indefinitely.

Bug: Issue 3992
Bug: Issue 3953
Change-Id: I4a54eb1e865b88f9a5531e864e0b1d58d638a4cd
This commit is contained in:
Andrew Bonventre
2016-05-02 15:59:59 -04:00
parent 3c88e386b5
commit 8f2310717b
13 changed files with 302 additions and 65 deletions

View File

@@ -141,16 +141,13 @@
this.disabled = true;
this._saveReview(obj).then(function(response) {
this.disabled = false;
if (!response.ok) {
alert('Oops. Something went wrong. Check the console and bug the ' +
'PolyGerrit team for assistance.');
return response.text().then(function(text) {
console.error(text);
});
}
if (!response.ok) { return response; }
this.draft = '';
this.fire('send', null, {bubbles: false});
}.bind(this)).catch(function(err) {
this.disabled = false;
throw err;
}.bind(this));
},