mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Add try/catch around error-throwing service calls.
This commit is contained in:
@@ -545,9 +545,19 @@ GuacAdmin.addUser = function(name) {
|
|||||||
// Delete user upon confirmation
|
// Delete user upon confirmation
|
||||||
if (confirm("Are you sure you want to delete the user \""
|
if (confirm("Are you sure you want to delete the user \""
|
||||||
+ name + "\"?")) {
|
+ name + "\"?")) {
|
||||||
GuacamoleService.Users.remove(GuacAdmin.selected_user);
|
|
||||||
deselect();
|
// Attempt to delete user
|
||||||
GuacAdmin.reset();
|
try {
|
||||||
|
GuacamoleService.Users.remove(GuacAdmin.selected_user);
|
||||||
|
deselect();
|
||||||
|
GuacAdmin.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alert on failure
|
||||||
|
catch (e) {
|
||||||
|
alert(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -815,9 +825,19 @@ GuacAdmin.addConnection = function(connection) {
|
|||||||
// Delete connection upon confirmation
|
// Delete connection upon confirmation
|
||||||
if (confirm("Are you sure you want to delete the connection \""
|
if (confirm("Are you sure you want to delete the connection \""
|
||||||
+ connection.id + "\"?")) {
|
+ connection.id + "\"?")) {
|
||||||
GuacamoleService.Connections.remove(GuacAdmin.selected_connection);
|
|
||||||
deselect();
|
// Attempt to delete connection
|
||||||
GuacAdmin.reset();
|
try {
|
||||||
|
GuacamoleService.Connections.remove(GuacAdmin.selected_connection);
|
||||||
|
deselect();
|
||||||
|
GuacAdmin.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alert on failure
|
||||||
|
catch (e) {
|
||||||
|
alert(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user