This is an automated email from the ASF dual-hosted git repository. guangning pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 52a380f7e93 Update proxy lookup throw exception type (#17600) 52a380f7e93 is described below commit 52a380f7e930e633dcefcbdb29ee1460e867dcfe Author: Guangning E <guangn...@streamnative.io> AuthorDate: Wed Sep 14 09:47:28 2022 +0800 Update proxy lookup throw exception type (#17600) --- .../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 1532b5c0f52..472de4327f9 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; }); @@ -330,7 +330,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.getTopics(), r.getTopicsHash(), r.isFiltered(), @@ -342,7 +342,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; }); } @@ -385,7 +385,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)); @@ -396,7 +396,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; });