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 2018/04/29 02:02:30 UTC

[GitHub] sijie closed pull request #1679: Provide meaningful error message in "pulsar-admin topics lookup"

sijie closed pull request #1679: Provide meaningful error message in "pulsar-admin topics lookup"
URL: https://github.com/apache/incubator-pulsar/pull/1679
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
index d560ffa041..01dd7f91d4 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
@@ -573,7 +573,7 @@ protected void validateGlobalNamespaceOwnership(NamespaceName namespace) {
                 Policies policies = policiesResult.get();
                 if (policies.replication_clusters.isEmpty()) {
                     String msg = String.format(
-                            "Global namespace does not have any clusters configured : local_cluster=%s ns=%s",
+                            "Namespace does not have any clusters configured : local_cluster=%s ns=%s",
                             localCluster, namespace.toString());
                     log.warn(msg);
                     validationFuture.completeExceptionally(new RestException(Status.PRECONDITION_FAILED, msg));
@@ -586,7 +586,7 @@ protected void validateGlobalNamespaceOwnership(NamespaceName namespace) {
                         return;
                     }
                     String msg = String.format(
-                            "Global namespace missing local cluster name in replication list : local_cluster=%s ns=%s repl_clusters=%s",
+                            "Namespace missing local cluster name in clusters list: local_cluster=%s ns=%s clusters=%s",
                             localCluster, namespace.toString(), policies.replication_clusters);
 
                     log.warn(msg);
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java
index 6b3d0476ba..b1588f141f 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/LookupImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pulsar.client.admin.internal;
 
-import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.client.WebTarget;
 
 import org.apache.pulsar.client.admin.Lookup;
@@ -38,14 +37,6 @@ public LookupImpl(WebTarget web, Authentication auth, boolean useTls) {
         v2lookup = web.path("/lookup/v2");
     }
 
-    private PulsarAdminException getLookupApiException(WebTarget target, Exception e) {
-        if (e instanceof ClientErrorException) {
-            return new PulsarAdminException((ClientErrorException) e, e.getMessage() + " at " + target.getUri());
-        } else {
-            return getApiException(e);
-        }
-    }
-
     @Override
     public String lookupTopic(String topic) throws PulsarAdminException {
         TopicName topicName = TopicName.get(topic);
@@ -55,7 +46,7 @@ public String lookupTopic(String topic) throws PulsarAdminException {
         try {
             return doTopicLookup(target);
         } catch (Exception e) {
-            throw getLookupApiException(target, e);
+            throw getApiException(e);
         }
     }
 
@@ -68,7 +59,7 @@ public String getBundleRange(String topic) throws PulsarAdminException {
         try {
             return request(target).get(String.class);
         } catch (Exception e) {
-            throw getLookupApiException(target, e);
+            throw getApiException(e);
         }
     }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services