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:31 UTC

[pulsar] branch branch-2.10 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.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git


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

commit 9fecb9e10ca8dd502fe07f46148ba7e8e4ff0156
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 c242242d0c9..76cdddccad2 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;
         });
@@ -323,7 +323,7 @@ public class LookupProxyHandler {
                     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));
@@ -334,7 +334,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;
         });
     }
@@ -377,7 +377,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));
@@ -388,7 +388,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;
         });