diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml
index 1ed96f7cd..373164279 100644
--- a/guacamole/src/main/webapp/client.xhtml
+++ b/guacamole/src/main/webapp/client.xhtml
@@ -61,7 +61,7 @@
-
+
@@ -101,47 +101,46 @@
// Tie UI to client
GuacUI.Client.attach(guac);
- try {
-
- // Calculate optimal width/height for display
- var pixel_density = window.devicePixelRatio || 1;
- var optimal_dpi = pixel_density * 96;
- var optimal_width = window.innerWidth * pixel_density;
- var optimal_height = window.innerHeight * pixel_density;
-
- // Scale width/height to be at least 600x600
- if (optimal_width < 600 || optimal_height < 600) {
- var scale = Math.max(600 / optimal_width, 600 / optimal_height);
- optimal_width = optimal_width * scale;
- optimal_height = optimal_height * scale;
- }
-
- // Get entire query string, and pass to connect().
- // Normally, only the "id" parameter is required, but
- // all parameters should be preserved and passed on for
- // the sake of authentication.
-
- var connect_string =
- window.location.search.substring(1)
- + "&width=" + Math.floor(optimal_width)
- + "&height=" + Math.floor(optimal_height)
- + "&dpi=" + Math.floor(optimal_dpi);
-
- // Add audio mimetypes to connect_string
- GuacUI.Audio.supported.forEach(function(mimetype) {
- connect_string += "&audio=" + encodeURIComponent(mimetype);
- });
-
- // Add video mimetypes to connect_string
- GuacUI.Video.supported.forEach(function(mimetype) {
- connect_string += "&video=" + encodeURIComponent(mimetype);
- });
-
- guac.connect(connect_string);
+ // Calculate optimal width/height for display
+ var pixel_density = window.devicePixelRatio || 1;
+ var optimal_dpi = pixel_density * 96;
+ var optimal_width = window.innerWidth * pixel_density;
+ var optimal_height = window.innerHeight * pixel_density;
+ // Scale width/height to be at least 600x600
+ if (optimal_width < 600 || optimal_height < 600) {
+ var scale = Math.max(600 / optimal_width, 600 / optimal_height);
+ optimal_width = optimal_width * scale;
+ optimal_height = optimal_height * scale;
}
- catch (e) {
- GuacUI.Client.showError("Cannot Connect", e.message);
+
+ // Get entire query string, and pass to connect().
+ // Normally, only the "id" parameter is required, but
+ // all parameters should be preserved and passed on for
+ // the sake of authentication.
+
+ var connect_string =
+ window.location.search.substring(1)
+ + "&width=" + Math.floor(optimal_width)
+ + "&height=" + Math.floor(optimal_height)
+ + "&dpi=" + Math.floor(optimal_dpi);
+
+ // Add audio mimetypes to connect_string
+ GuacUI.Audio.supported.forEach(function(mimetype) {
+ connect_string += "&audio=" + encodeURIComponent(mimetype);
+ });
+
+ // Add video mimetypes to connect_string
+ GuacUI.Video.supported.forEach(function(mimetype) {
+ connect_string += "&video=" + encodeURIComponent(mimetype);
+ });
+
+ try {
+ guac.connect(connect_string);
+ }
+ catch (status) {
+ var message = GuacUI.Client.errors[status.code] || GuacUI.Client.errors.DEFAULT;
+ GuacUI.Client.showError("Cannot Connect", message);
}
}, 0);
diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js
index f3cff081d..b45247928 100644
--- a/guacamole/src/main/webapp/scripts/client-ui.js
+++ b/guacamole/src/main/webapp/scripts/client-ui.js
@@ -63,6 +63,104 @@ GuacUI.Client = {
},
+ /**
+ * Enumeration of all error messages for each applicable error code.
+ */
+ "errors": {
+
+ 0x0201: "The Guacamole server has rejected this connection attempt \
+ because there are too many active connections. Please wait \
+ a few minutes and try again.",
+
+ 0x0202: "The remote desktop server encountered an error and has closed \
+ the connection. Please try again or contact your system \
+ administrator.",
+
+ 0x0203: "The Guacamole server has closed the connection because the \
+ remote desktop is taking too long to respond. Please try \
+ again or contact your system administrator.",
+
+ 0x0204: "The requested connection does not exist. Please check the \
+ connection name and try again.",
+
+ 0x0205: "This connection is currently in use, and concurrent access to \
+ this connection is not allowed. Please try again later.",
+
+ 0x0301: "You do not have permission to access this connection because \
+ you are not logged in. Please log in and try again.",
+
+ 0x0303: "You do not have permission to access this connection. If you \
+ require access, please ask your system administrator to add \
+ you the list of allowed users, or check your system settings.",
+
+ 0x0308: "The Guacamole server has closed the connection because there \
+ has been no response from your browser for long enough that \
+ it appeared to be disconnected. This is commonly caused by \
+ network problems, such as spotty wireless signal, or simply \
+ very slow network speeds. Please check your network and try \
+ again.",
+
+ 0x031D: "The Guacamole server is denying access to this connection \
+ because you have exhausted the limit for simultaneous \
+ connection use by an individual user. Please close one or \
+ more connections and try again.",
+
+ "DEFAULT": "An internal error has occurred within the Guacamole \
+ server, and the connection has been terminated. If \
+ the problem persists, please notify your system \
+ administrator, or check your system logs."
+
+ },
+
+ /**
+ * Enumeration of all error messages for each applicable error code. This
+ * list is specific to file uploads.
+ */
+ "upload_errors": {
+
+ 0x0100: "File transfer is either not supported or not enabled. Please \
+ contact your system administrator, or check your system logs.",
+
+ 0x0201: "Too many files are currently being transferred. Please wait \
+ for existing transfers to complete, and then try again.",
+
+ 0x0202: "The remote desktop server encountered an error during \
+ transfer. Please try again or contact your system \
+ administrator.",
+
+ 0x0203: "The file cannot be transferred because the remote desktop \
+ server is taking too long to respond. Please try again or \
+ or contact your system administrator.",
+
+ 0x0204: "The destination for the file transfer does not exist. Please \
+ check that the destionation exists and try again.",
+
+ 0x0205: "The destination for the file transfer is currently locked. \
+ Please wait for any in-progress tasks to complete and try \
+ again.",
+
+ 0x0301: "You do not have permission to upload this file because you \
+ are not logged in. Please log in and try again.",
+
+ 0x0303: "You do not have permission to upload this file. If you \
+ require access, please check your system settings, or \
+ check with your system administrator.",
+
+ 0x0308: "The file transfer has stalled. This is commonly caused by \
+ network problems, such as spotty wireless signal, or \
+ simply very slow network speeds. Please check your \
+ network and try again.",
+
+ 0x031D: "Too many files are currently being transferred. Please wait \
+ for existing transfers to complete, and then try again.",
+
+ "DEFAULT": "An internal error has occurred within the Guacamole \
+ server, and the connection has been terminated. If \
+ the problem persists, please notify your system \
+ administrator, or check your system logs.",
+
+ },
+
/* Constants */
"LONG_PRESS_DETECT_TIMEOUT" : 800, /* milliseconds */
@@ -780,13 +878,14 @@ GuacUI.Client.attach = function(guac) {
* receives an error.
*/
- guac.onerror = function(error) {
+ guac.onerror = function(status) {
// Disconnect, if connected
guac.disconnect();
// Display error message
- GuacUI.Client.showError("Connection Error", error);
+ var message = GuacUI.Client.errors[status.code] || GuacUI.Client.errors.DEFAULT;
+ GuacUI.Client.showError("Connection Error", message);
};
@@ -1157,12 +1256,14 @@ GuacUI.Client.attach = function(guac) {
// Invalidate stream on all errors
// Continue upload when acknowledged
- stream.onack = function(text, code) {
+ stream.onack = function(status) {
- // Handle codes
- if (code >= 0x0100) {
+ // Handle errors
+ if (status.isError()) {
valid = false;
- upload.showError(text);
+ var message = GuacUI.Client.upload_errors[status.code]
+ || GuacUI.Client.upload_errors.DEFAULT;
+ upload.showError(message);
}
// Abort upload if stream is invalid