You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/10 14:38:08 UTC

[GitHub] [pulsar] ivankelly commented on a change in pull request #11627: PIP-91: Separate lookup timeout from operation timeout

ivankelly commented on a change in pull request #11627:
URL: https://github.com/apache/pulsar/pull/11627#discussion_r686083771



##########
File path: pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java
##########
@@ -957,77 +1003,110 @@ public static PulsarClientException unwrap(Throwable t) {
         // site
         Throwable cause = t.getCause();
         String msg = cause.getMessage();
+        PulsarClientException newException = null;
         if (cause instanceof TimeoutException) {
-            return new TimeoutException(msg);
+            newException = new TimeoutException(msg);
         } else if (cause instanceof InvalidConfigurationException) {
-            return new InvalidConfigurationException(msg);
+            newException = new InvalidConfigurationException(msg);
         } else if (cause instanceof AuthenticationException) {
-            return new AuthenticationException(msg);
+            newException = new AuthenticationException(msg);
         } else if (cause instanceof IncompatibleSchemaException) {
-            return new IncompatibleSchemaException(msg);
+            newException = new IncompatibleSchemaException(msg);
         } else if (cause instanceof TooManyRequestsException) {
-            return new TooManyRequestsException(msg);
+            newException = new TooManyRequestsException(msg);
         } else if (cause instanceof LookupException) {
-            return new LookupException(msg);
+            newException = new LookupException(msg);
         } else if (cause instanceof ConnectException) {
-            return new ConnectException(msg);
+            newException = new ConnectException(msg);
         } else if (cause instanceof AlreadyClosedException) {
-            return new AlreadyClosedException(msg);
+            newException = new AlreadyClosedException(msg);
         } else if (cause instanceof TopicTerminatedException) {
-            return new TopicTerminatedException(msg);
+            newException = new TopicTerminatedException(msg);
         } else if (cause instanceof AuthorizationException) {
-            return new AuthorizationException(msg);
+            newException = new AuthorizationException(msg);
         } else if (cause instanceof GettingAuthenticationDataException) {
-            return new GettingAuthenticationDataException(msg);
+            newException = new GettingAuthenticationDataException(msg);
         } else if (cause instanceof UnsupportedAuthenticationException) {
-            return new UnsupportedAuthenticationException(msg);
+            newException = new UnsupportedAuthenticationException(msg);
         } else if (cause instanceof BrokerPersistenceException) {
-            return new BrokerPersistenceException(msg);
+            newException = new BrokerPersistenceException(msg);
         } else if (cause instanceof BrokerMetadataException) {
-            return new BrokerMetadataException(msg);
+            newException = new BrokerMetadataException(msg);
         } else if (cause instanceof ProducerBusyException) {
-            return new ProducerBusyException(msg);
+            newException = new ProducerBusyException(msg);
         } else if (cause instanceof ConsumerBusyException) {
-            return new ConsumerBusyException(msg);
+            newException = new ConsumerBusyException(msg);
         } else if (cause instanceof NotConnectedException) {
-            return new NotConnectedException();
+            newException = new NotConnectedException();
         } else if (cause instanceof InvalidMessageException) {
-            return new InvalidMessageException(msg);
+            newException = new InvalidMessageException(msg);
         } else if (cause instanceof InvalidTopicNameException) {
-            return new InvalidTopicNameException(msg);
+            newException = new InvalidTopicNameException(msg);
         } else if (cause instanceof NotSupportedException) {
-            return new NotSupportedException(msg);
+            newException = new NotSupportedException(msg);
         } else if (cause instanceof NotAllowedException) {
-            return new NotAllowedException(msg);
+            newException = new NotAllowedException(msg);
         } else if (cause instanceof ProducerQueueIsFullError) {
-            return new ProducerQueueIsFullError(msg);
+            newException = new ProducerQueueIsFullError(msg);
         } else if (cause instanceof ProducerBlockedQuotaExceededError) {
-            return new ProducerBlockedQuotaExceededError(msg);
+            newException = new ProducerBlockedQuotaExceededError(msg);
         } else if (cause instanceof ProducerBlockedQuotaExceededException) {
-            return new ProducerBlockedQuotaExceededException(msg);
+            newException = new ProducerBlockedQuotaExceededException(msg);
         } else if (cause instanceof ChecksumException) {
-            return new ChecksumException(msg);
+            newException = new ChecksumException(msg);
         } else if (cause instanceof CryptoException) {
-            return new CryptoException(msg);
+            newException = new CryptoException(msg);
         } else if (cause instanceof ConsumerAssignException) {
-            return new ConsumerAssignException(msg);
+            newException = new ConsumerAssignException(msg);
         } else if (cause instanceof MessageAcknowledgeException) {
-            return new MessageAcknowledgeException(msg);
+            newException = new MessageAcknowledgeException(msg);
         } else if (cause instanceof TransactionConflictException) {
-            return new TransactionConflictException(msg);
+            newException = new TransactionConflictException(msg);
         } else if (cause instanceof TopicDoesNotExistException) {
-            return new TopicDoesNotExistException(msg);
+            newException = new TopicDoesNotExistException(msg);
         } else if (cause instanceof ProducerFencedException) {
-            return new ProducerFencedException(msg);
+            newException = new ProducerFencedException(msg);
         } else if (cause instanceof MemoryBufferIsFullError) {
-            return new MemoryBufferIsFullError(msg);
+            newException = new MemoryBufferIsFullError(msg);
         } else if (cause instanceof NotFoundException) {
-            return new NotFoundException(msg);
+            newException = new NotFoundException(msg);
         } else {
-            return new PulsarClientException(t);
+            newException = new PulsarClientException(t);
         }
+
+        Collection<Throwable> previousExceptions = getPreviousExceptions(t);
+        if (t != null) {

Review comment:
       it should be checking whether previousExceptions is null




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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