From b8c1dba1cba892a863bb84b4249b193a1711cbe1 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Tue, 29 Jan 2013 17:31:12 -0500 Subject: [PATCH 1/3] Catch save error and throw it in the user's face (bug 147). May need to add catches in more places or put in $.ajaxSetup? --- cms/static/js/views/settings/main_settings_view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cms/static/js/views/settings/main_settings_view.js b/cms/static/js/views/settings/main_settings_view.js index 9037d4510c..704623b56e 100644 --- a/cms/static/js/views/settings/main_settings_view.js +++ b/cms/static/js/views/settings/main_settings_view.js @@ -55,7 +55,10 @@ CMS.Views.ValidatingView = Backbone.View.extend({ var newVal = $(event.currentTarget).val(); if (currentVal != newVal) { this.clearValidationErrors(); - this.model.save(field, newVal); + this.model.save(field, newVal, { error : function(model, error) { + // this handler is for the client:server communication not the vlidation errors which handleValidationError catches + if (error.responseText) window.alert("Error: " + error.responseText); + }}); return true; } else return false; From ab4fd03dd8c5b42afcaa0258e27d51245d613671 Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 30 Jan 2013 09:43:27 -0500 Subject: [PATCH 2/3] Catch any and all save errors --- .../js/models/settings/course_details.js | 12 +++++- .../js/views/settings/main_settings_view.js | 38 +++++++++++++++---- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js index ab80179142..61e31133fd 100644 --- a/cms/static/js/models/settings/course_details.js +++ b/cms/static/js/models/settings/course_details.js @@ -68,10 +68,18 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({ save_videosource: function(newsource) { // newsource either is