ECOM-1447: Added the custom message if there is an internal server error on ajax call.
This commit is contained in:
@@ -278,7 +278,25 @@
|
||||
// Expect that an error is displayed and that auth complete is not triggered
|
||||
expect(view.$errors).not.toHaveClass('hidden');
|
||||
expect(authComplete).toBe(false);
|
||||
expect(view.$errors.text()).toContain('Please check your internet connection and try again.');
|
||||
expect(view.$errors.text()).toContain(
|
||||
'An error has occurred. Check your Internet connection and try again.'
|
||||
);
|
||||
});
|
||||
it('displays an error if there is a server error', function () {
|
||||
createLoginView(this);
|
||||
|
||||
// Submit the form, with successful validation
|
||||
submitForm(true);
|
||||
|
||||
// Simulate an error from the LMS servers
|
||||
AjaxHelpers.respondWithError(requests, 500);
|
||||
|
||||
// Expect that an error is displayed and that auth complete is not triggered
|
||||
expect(view.$errors).not.toHaveClass('hidden');
|
||||
expect(authComplete).toBe(false);
|
||||
expect(view.$errors.text()).toContain(
|
||||
'An error has occurred. Try refreshing the page, or check your Internet connection.'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -103,12 +103,13 @@
|
||||
},
|
||||
|
||||
saveError: function( error ) {
|
||||
var msg = error.responseText;
|
||||
if (error.status === 0) {
|
||||
this.errors = ['<li>' + gettext('Please check your internet connection and try again.') + '</li>'];
|
||||
}
|
||||
else {
|
||||
this.errors = ['<li>' + error.responseText + '</li>'];
|
||||
msg = gettext('An error has occurred. Check your Internet connection and try again.');
|
||||
} else if(error.status === 500){
|
||||
msg = gettext('An error has occurred. Try refreshing the page, or check your Internet connection.');
|
||||
}
|
||||
this.errors = ['<li>' + msg + '</li>'];
|
||||
this.setErrors();
|
||||
this.element.hide( this.$resetSuccess );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user