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/09/23 13:08:33 UTC

[GitHub] [pulsar] nodece commented on a change in pull request #12155: [Broker] Improve exceptions thrown when handling the schema resource

nodece commented on a change in pull request #12155:
URL: https://github.com/apache/pulsar/pull/12155#discussion_r714778891



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SchemasResourceBase.java
##########
@@ -177,20 +177,13 @@ public void postSchema(PostSchemaPayload payload, boolean authoritative, AsyncRe
                                     error.getMessage()).build());
                         } else {
                             log.error("[{}] Failed to post schema for topic {}", clientAppId(), topicName, error);
-                            response.resume(Response.serverError().build());
+                            response.resume(new RestException(error));
                         }
                         return null;
                     });
         }).exceptionally(error -> {
-            if (error.getCause() instanceof RestException) {
-                // Unprocessable Entity
-                response.resume(Response
-                        .status(((RestException) error.getCause()).getResponse().getStatus(), error.getMessage())
-                        .build());
-            } else {
-                log.error("[{}] Failed to post schema for topic {}", clientAppId(), topicName, error);
-                response.resume(Response.serverError().build());
-            }
+            log.error("[{}] Failed to post schema for topic {}", clientAppId(), topicName, error);
+            response.resume(new RestException(error));

Review comment:
       Good catch.




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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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