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:04:43 UTC

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

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



##########
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:
       This seems to overwrite the status of the RestException thrown by the upper layer.




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