[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358248 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -301,11 +301,17 @@ public UnAckedMessageTracker getUnAckedMessageTracker() { }).exceptionally(e -> { log.error("[{}][{}] Failed to unsubscribe: {}", topic, subscription, e.getCause().getMessage()); setState(State.Ready); -unsubscribeFuture.completeExceptionally(e.getCause()); +unsubscribeFuture.completeExceptionally( +new PulsarClientException.WrapperException( +String.format("[%s][%s] Failed to unsubscribe", topicName.toString(), subscription), + +e.getCause())); return null; }); } else { -unsubscribeFuture.completeExceptionally(new PulsarClientException("Not connected to broker")); +unsubscribeFuture.completeExceptionally( +new PulsarClientException( Review comment: "Client is not connected to broker when unsubscribing subscription %s of topic %s" 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352359003 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -1466,7 +1480,10 @@ public void seek(long timestamp) throws PulsarClientException { seekFuture.complete(null); }).exceptionally(e -> { log.error("[{}][{}] Failed to reset subscription: {}", topic, subscription, e.getCause().getMessage()); -seekFuture.completeExceptionally(e.getCause()); +seekFuture.completeExceptionally( +new PulsarClientException.WrapperException( Review comment: I am not sure WrapperException is the right fix here. because it will change the client behavior. for example, if a client used to handle exeception A, now we are throwing a WrapperException of A. We should reconstruct a A with an updated error message and its stack trace. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358161 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java ## @@ -251,8 +252,10 @@ private void getTopicsUnderNamespace(InetSocketAddress socketAddress, }).exceptionally((e) -> { long nextDelay = Math.min(backoff.next(), remainingTime.get()); if (nextDelay <= 0) { -topicsFuture.completeExceptionally(new PulsarClientException -.TimeoutException("Could not getTopicsUnderNamespace within configured timeout.")); +topicsFuture.completeExceptionally( +new PulsarClientException.TimeoutException( +format("[%s] Could not getTopicsUnderNamespace within configured timeout", Review comment: It is much clear to write the error message as a sentence rather than putting the namespace at the beginning. Thinking from end-users' perspective, which one is easier to understand? "Could not get topics of namespace %s within configured timeout" 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358827 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -1442,11 +1454,13 @@ public void seek(long timestamp) throws PulsarClientException { public CompletableFuture seekAsync(long timestamp) { if (getState() == State.Closing || getState() == State.Closed) { return FutureUtil -.failedFuture(new PulsarClientException.AlreadyClosedException("Consumer was already closed")); +.failedFuture(new PulsarClientException.AlreadyClosedException( +String.format("[%s][%s] Consumer was already closed", topicName.toString(), subscription))); } if (!isConnected()) { -return FutureUtil.failedFuture(new PulsarClientException("Not connected to broker")); +return FutureUtil.failedFuture(new PulsarClientException( +String.format("[%s][%s] Not connected to broker", topicName.toString(), subscription))); Review comment: Please fix all occurrences that have similar issues. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358178 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -301,11 +301,17 @@ public UnAckedMessageTracker getUnAckedMessageTracker() { }).exceptionally(e -> { log.error("[{}][{}] Failed to unsubscribe: {}", topic, subscription, e.getCause().getMessage()); setState(State.Ready); -unsubscribeFuture.completeExceptionally(e.getCause()); +unsubscribeFuture.completeExceptionally( +new PulsarClientException.WrapperException( +String.format("[%s][%s] Failed to unsubscribe", topicName.toString(), subscription), Review comment: "Failed to unsubscribe subscription %s of topic %s" 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358429 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -1442,11 +1454,13 @@ public void seek(long timestamp) throws PulsarClientException { public CompletableFuture seekAsync(long timestamp) { if (getState() == State.Closing || getState() == State.Closed) { return FutureUtil -.failedFuture(new PulsarClientException.AlreadyClosedException("Consumer was already closed")); +.failedFuture(new PulsarClientException.AlreadyClosedException( +String.format("[%s][%s] Consumer was already closed", topicName.toString(), subscription))); } if (!isConnected()) { -return FutureUtil.failedFuture(new PulsarClientException("Not connected to broker")); +return FutureUtil.failedFuture(new PulsarClientException( +String.format("[%s][%s] Not connected to broker", topicName.toString(), subscription))); Review comment: This error message doesn't tell what action that this exception is about. It only tells "client is not connected to a broker". It is not useful at all. You should include the action in the error message. "Client is not connected to broker when seeking subscription %s of topic %s to timestamp %d". 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [pulsar] sijie commented on a change in pull request #5714: Add more info in the error messages
sijie commented on a change in pull request #5714: Add more info in the error messages URL: https://github.com/apache/pulsar/pull/5714#discussion_r352358664 ## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java ## @@ -1442,11 +1454,13 @@ public void seek(long timestamp) throws PulsarClientException { public CompletableFuture seekAsync(long timestamp) { if (getState() == State.Closing || getState() == State.Closed) { return FutureUtil -.failedFuture(new PulsarClientException.AlreadyClosedException("Consumer was already closed")); +.failedFuture(new PulsarClientException.AlreadyClosedException( +String.format("[%s][%s] Consumer was already closed", topicName.toString(), subscription))); Review comment: Same comments as below. "Consumer %s was already closed when seeking subscription %s of topic %s to timestamp %d", consumerName, subscription, topicName, timestamp 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: us...@infra.apache.org With regards, Apache Git Services