-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ServerCnx] Improve error logging for topic not found #13950
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.info("[{}] 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it still print the exception stack in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still prints the exception stack here, but it doesn't for exceptions that have a cause of type |
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could also try to not create a 2nd exception here which is only used to do
getMessage()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, although we also use the exception here:
BrokerServiceException.getClientErrorCode(cause)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merlimat - would you like me to introduce more complicated logic for getting the client error code, or is this sufficient?