You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/09/19 01:01:54 UTC

[pulsar] branch branch-2.9 updated: Update proxy lookup throw exception type (#17600)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new ab78a7e0c91 Update proxy lookup throw exception type (#17600)
ab78a7e0c91 is described below

commit ab78a7e0c912d014aa7f9ed3e396b63f9e6ba9b1
Author: Guangning E <gu...@streamnative.io>
AuthorDate: Wed Sep 14 09:47:28 2022 +0800

    Update proxy lookup throw exception type (#17600)
    
    (cherry picked from commit 52a380f7e930e633dcefcbdb29ee1460e867dcfe)
---
 .../org/apache/pulsar/proxy/server/LookupProxyHandler.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
index d9d208085fd..cbebfa34fa1 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
@@ -151,7 +151,7 @@ public class LookupProxyHandler {
                 if (t != null) {
                     log.warn("[{}] Failed to lookup topic {}: {}", clientAddress, topic, t.getMessage());
                     proxyConnection.ctx().writeAndFlush(
-                        Commands.newLookupErrorResponse(ServerError.ServiceNotReady, t.getMessage(), clientRequestId));
+                        Commands.newLookupErrorResponse(getServerError(t), t.getMessage(), clientRequestId));
                 } else {
                     String brokerUrl = connectWithTLS ? r.brokerUrlTls : r.brokerUrl;
                     if (r.redirect) {
@@ -179,7 +179,7 @@ public class LookupProxyHandler {
         }).exceptionally(ex -> {
             // Failed to connect to backend broker
             proxyConnection.ctx().writeAndFlush(
-                    Commands.newLookupErrorResponse(ServerError.ServiceNotReady, ex.getMessage(), clientRequestId));
+                    Commands.newLookupErrorResponse(getServerError(ex), ex.getMessage(), clientRequestId));
             return null;
         });
     }
@@ -249,7 +249,7 @@ public class LookupProxyHandler {
             });
         }).exceptionally(ex -> {
             // Failed to connect to backend broker
-            proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(ServerError.ServiceNotReady,
+            proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(getServerError(ex),
                     ex.getMessage(), clientRequestId));
             return null;
         });
@@ -322,7 +322,7 @@ public class LookupProxyHandler {
                 if (t != null) {
                     log.warn("[{}] Failed to get TopicsOfNamespace {}: {}", clientAddress, namespaceName, t.getMessage());
                     proxyConnection.ctx().writeAndFlush(
-                        Commands.newError(clientRequestId, ServerError.ServiceNotReady, t.getMessage()));
+                        Commands.newError(clientRequestId, getServerError(t), t.getMessage()));
                 } else {
                     proxyConnection.ctx().writeAndFlush(
                         Commands.newGetTopicsOfNamespaceResponse(r, clientRequestId));
@@ -333,7 +333,7 @@ public class LookupProxyHandler {
         }).exceptionally(ex -> {
             // Failed to connect to backend broker
             proxyConnection.ctx().writeAndFlush(
-                    Commands.newError(clientRequestId, ServerError.ServiceNotReady, ex.getMessage()));
+                    Commands.newError(clientRequestId, getServerError(ex), ex.getMessage()));
             return null;
         });
     }
@@ -376,7 +376,7 @@ public class LookupProxyHandler {
                 if (t != null) {
                     log.warn("[{}] Failed to get schema {}: {}", clientAddress, topic, t);
                     proxyConnection.ctx().writeAndFlush(
-                        Commands.newError(clientRequestId, ServerError.ServiceNotReady, t.getMessage()));
+                        Commands.newError(clientRequestId, getServerError(t), t.getMessage()));
                 } else {
                     proxyConnection.ctx().writeAndFlush(
                         Commands.newGetSchemaResponse(clientRequestId, r));
@@ -387,7 +387,7 @@ public class LookupProxyHandler {
         }).exceptionally(ex -> {
             // Failed to connect to backend broker
             proxyConnection.ctx().writeAndFlush(
-                    Commands.newError(clientRequestId, ServerError.ServiceNotReady, ex.getMessage()));
+                    Commands.newError(clientRequestId, getServerError(ex), ex.getMessage()));
             return null;
         });