Shell page: fix [object Object] message shown on certain command errors
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/shell/nls/root/messages.js b/bundles/org.eclipse.orion.client.core/web/orion/shell/nls/root/messages.js
index 14bec0f..3dd2331 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/shell/nls/root/messages.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/shell/nls/root/messages.js
@@ -24,6 +24,8 @@
 	"Clears the shell screen": "Clears the shell screen",
 	"'${0}' is not valid": "'${0}' is not valid",
 	"Error: ${0}": "Error: ${0}",
+	"NoResponseFromServer": "No response from server for ${0}. Check your internet connection and try again.",
+	"ServerError": "Server error: ${0} returned ${1} ${2}",
 	"Succeeded": "Succeeded",
 	"Aborted": "Aborted",
 	"The name of the plug-in": "The name of the plug-in",
diff --git a/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js b/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js
index aed3ffb..64dc4fb 100644
--- a/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js
+++ b/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js
@@ -11,7 +11,7 @@
  *******************************************************************************/

 

 /*global define window*/

-/*jslint browser:true*/

+/*jslint browser:true sub:true*/

 

 define(["i18n!orion/shell/nls/messages", "require", "dojo", "orion/bootstrap", "orion/commands", "orion/fileClient", "orion/searchClient", "orion/globalCommands",

 		"orion/widgets/Shell", "shell/shellPageFileService", "shell/paramType-file", "shell/paramType-plugin", "orion/i18nUtil", "shell/extensionCommands", "orion/contentTypes", "orion/pluginregistry"],

@@ -22,17 +22,23 @@
 	var contentTypeService, openWithCommands = [], serviceRegistry;

 	var pluginRegistry, pluginType, preferences;

 

-	var resolveError = function(result, xhrResult) {

+	var resolveError = function(promise, xhrResult) {

 		var error = xhrResult;

 		try {

 			error = JSON.parse(xhrResult.responseText);

 		} catch (e) {}

 		if (error && error.Message) {

-			error = error.Message;

+			error = i18nUtil.formatMessage(messages["Error: ${0}"], error.Message);

+		} else if (typeof xhrResult.url === "string") {

+			if (xhrResult.status === 0) {

+				error = i18nUtil.formatMessage(messages["NoResponseFromServer"], xhrResult.url);

+			} else {

+				error = i18nUtil.formatMessage(messages["ServerError"], xhrResult.url, xhrResult.status, xhrResult.statusText);

+			}

 		}

 		var errNode = document.createElement("span"); //$NON-NLS-0$

-		errNode.textContent = i18nUtil.formatMessage(messages["Error: ${0}"], error);

-		result.resolve(errNode);

+		errNode.textContent = error;

+		promise.resolve(errNode);

 	};

 

 	/* general functions for working with file system nodes */