You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2021/02/14 13:30:13 UTC

[GitHub] [guacamole-client] holograph commented on a change in pull request #500: GUACAMOLE-1048: Support server control commands during handshake

holograph commented on a change in pull request #500:
URL: https://github.com/apache/guacamole-client/pull/500#discussion_r575809104



##########
File path: guacamole-common/src/main/java/org/apache/guacamole/GuacamoleServerErrorCommandException.java
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole;
+
+import org.apache.guacamole.protocol.GuacamoleStatus;
+
+/**
+ * The exception thrown when the Guacamole server explicitly sends an error
+ * command to the client. The error message and status code reflect the arguments
+ * of the error command as determined by the server.
+ */
+public class GuacamoleServerErrorCommandException extends GuacamoleServerException {

Review comment:
       You're right about the command/instruction thing, I missed it. The problem with `GuacamoleHandshakeException` is that it ties the error to the specific connection phase; an `error` instruction can occur at any time in any phase. I do believe it deserves special semantics to distinguish it from any other error condition, because that allows for very explicit and clear `catch` blocks - this was the original impetus for this PR.
   
   I honestly couldn't find a more descriptive, and semantically appropriate, name than `GuacamoleServerErrorInstructionException` (adjusting for your comment, of course). Considering any part of it:
   * Guacamole can be omitted since it's contextual and present in the package name, but then it won't follow the already-established convention;
   * Server can't really be omitted, as it's not denoted by the package and it's semantically important;
   * ErrorInstruction is, well, what it is;
   * and Exception can be omitted, but that would be against the preexisting convention in this codebase (and the Java ecosystem as a whole).
   
   I know at this point most people reading this think this is splitting hairs, sorry ladies and gentlemen :-) Serious though @mike-jumper, if you have any better names I'd be happy to take them. This one is a mouthful.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org