code: public static InvalidNameException fromThrowable(Throwable cause) {
      return (cause instanceof InvalidNameException)
                     ? (InvalidNameException) cause
                     : new InvalidNameException(cause);
    }
docs: Converts a Throwable to a InvalidNameException. If the Throwable is a
  InvalidNameException, it will be passed through unmodified; otherwise, it will be wrapped
  in a new InvalidNameException.
  
  @param cause the Throwable to convert
  
  @return a InvalidNameException