michaeljmarshall commented on a change in pull request #13950:
URL: https://github.com/apache/pulsar/pull/13950#discussion_r792299613
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -1273,12 +1273,13 @@ protected void handleProducer(final CommandProducer
cmdProducer) {
return null;
}
+ // Do not print stack traces for expected exceptions
if (cause instanceof NoSuchElementException) {
cause = new TopicNotFoundException("Topic Not Found.");
- }
- if (!Exceptions.areExceptionsPresentInChain(cause,
+ log.error("[{}] Failed to load topic {}, producerId={}:
Topic not found", remoteAddress, topicName,
+ producerId);
+ } else if (!Exceptions.areExceptionsPresentInChain(cause,
ServiceUnitNotReadyException.class,
ManagedLedgerException.class)) {
- // Do not print stack traces for expected exceptions
log.error("[{}] Failed to create topic {}, producerId={}",
remoteAddress, topicName, producerId, exception);
Review comment:
It still prints the exception stack here, but it doesn't for exceptions
that have a cause of type `NoSuchElementException`. I relocated the comment
because we're avoiding printing stack traces in this conditional block.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]