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-unsubscr...@pulsar.apache.org

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


Reply via email to