code: private static void handleUpstreamErrors(GuacamoleInstruction instruction)
              throws GuacamoleUpstreamException {
  
          // Ignore error instructions which are missing the status code
          List<String> args = instruction.getArgs();
          if (args.size() < 2) {
              logger.debug("Received \"error\" instruction without status code.");
              return;
          }
  
          // Parse the status code from the received error instruction
          int statusCode;
          try {
              statusCode = Integer.parseInt(args.get(1));
          }
          catch (NumberFormatException e) {
              logger.debug("Received \"error\" instruction with non-numeric status code.", e);
              return;
          }
  
          // Translate numeric status code into a GuacamoleStatus
          GuacamoleStatus status = GuacamoleStatus.fromGuacamoleStatusCode(statusCode);
          if (status == null) {
              logger.debug("Received \"error\" instruction with unknown/invalid status code: {}", statusCode);
              return;
          }
  
          // Only handle error instructions related to the upstream remote desktop
          switch (status) {
  
              // Generic upstream error
              case UPSTREAM_ERROR:
                  throw new GuacamoleUpstreamException(args.get(0));
  
              // Upstream is unreachable
              case UPSTREAM_NOT_FOUND:
                  throw new GuacamoleUpstreamNotFoundException(args.get(0));
  
              // Upstream did not respond
              case UPSTREAM_TIMEOUT:
                  throw new GuacamoleUpstreamTimeoutException(args.get(0));
  
              // Upstream is refusing the connection
              case UPSTREAM_UNAVAILABLE:
                  throw new GuacamoleUpstreamUnavailableException(args.get(0));
  
          }
  
      }
docs: Parses the given "error" instruction, throwing an exception if the
  instruction represents an error from the upstream remote desktop.
  
  @param instruction
  The "error" instruction to parse.
  
  @throws GuacamoleUpstreamException
  If the "error" instruction represents an error from the upstream
  remote desktop.