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/02/09 19:57:24 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #9544: [C++] Add detail logs for schema related messages

sijie commented on a change in pull request #9544:
URL: https://github.com/apache/pulsar/pull/9544#discussion_r573194221



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1167,9 +1167,13 @@ protected void handleProducer(final CommandProducer cmdProducer) {
                             CompletableFuture<SchemaVersion> schemaVersionFuture = tryAddSchema(topic, schema);
 
                             schemaVersionFuture.exceptionally(exception -> {
+                                String message = exception.getMessage();
+                                if (exception.getCause() != null) {
+                                    message += (" caused by " + exception.getCause().toString());

Review comment:
       ```suggestion
                                       message += (" caused by " + exception.getCause());
   ```
   
   You don't need to use `toString` here. It is problematic as `exception.getCause` can return `null`.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1727,7 +1731,11 @@ protected void handleGetOrCreateSchema(CommandGetOrCreateSchema commandGetOrCrea
                 CompletableFuture<SchemaVersion> schemaVersionFuture = tryAddSchema(topic, schema);
                 schemaVersionFuture.exceptionally(ex -> {
                     ServerError errorCode = BrokerServiceException.getClientErrorCode(ex);
-                    commandSender.sendGetOrCreateSchemaErrorResponse(requestId, errorCode, ex.getMessage());
+                    String message = ex.getMessage();
+                    if (ex.getCause() != null) {
+                        message += (" caused by " + ex.getCause().toString());

Review comment:
       ```suggestion
                           message += (" caused by " + ex.getCause());
   ```




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

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