Commit 16e2ee80 by David Baumgold

Abstract out the unknown error message and i18n

parent 1eae6759
...@@ -169,6 +169,7 @@ ...@@ -169,6 +169,7 @@
name=context_course.location.name, name=context_course.location.name,
email="@@EMAIL@@", email="@@EMAIL@@",
))}"; ))}";
var unknownErrorMessage = gettext("Unknown")
$(document).ready(function() { $(document).ready(function() {
var $createUserForm = $('#create-user-form'); var $createUserForm = $('#create-user-form');
...@@ -226,9 +227,9 @@ ...@@ -226,9 +227,9 @@
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
var message; var message;
try { try {
message = JSON.parse(jqXHR.responseText).error || "Unknown"; message = JSON.parse(jqXHR.responseText).error || unknownErrorMessage;
} catch (e) { } catch (e) {
message = "Unknown"; message = unknownErrorMessage
} }
var prompt = new CMS.Views.Prompt.Error({ var prompt = new CMS.Views.Prompt.Error({
title: gettext("Error adding user"), title: gettext("Error adding user"),
...@@ -292,9 +293,9 @@ ...@@ -292,9 +293,9 @@
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
var message; var message;
try { try {
message = JSON.parse(jqXHR.responseText).error || "Unknown"; message = JSON.parse(jqXHR.responseText).error || unknownErrorMessage;
} catch (e) { } catch (e) {
message = "Unknown"; message = unknownErrorMessage;
} }
var prompt = new CMS.Views.Prompt.Error({ var prompt = new CMS.Views.Prompt.Error({
title: gettext("Error removing user"), title: gettext("Error removing user"),
...@@ -348,9 +349,9 @@ ...@@ -348,9 +349,9 @@
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
var message; var message;
try { try {
message = JSON.parse(jqXHR.responseText).error || "Unknown"; message = JSON.parse(jqXHR.responseText).error || unknownErrorMessage;
} catch (e) { } catch (e) {
message = "Unknown"; message = unknownErrorMessage;
} }
var prompt = new CMS.Views.Prompt.Error({ var prompt = new CMS.Views.Prompt.Error({
title: gettext("There was an error changing the user's role"), title: gettext("There was an error changing the user's role"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment