-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][client] Throw more meaningful derived exception instead of PulsarClientException #15594
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
Conversation
merlimat
left a comment
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.
Looks good. We should probably also have assertions in the tests to ensure these proper exception are thrown, so that we don't have regression cases.
Ok, I'll add unit test later. |
@merlimat Unit test added, PTAL |
|
/pulsarbot rerun-failure-checks |
853a490 to
2020ab7
Compare
|
/pulsarbot rerun-failure-checks |
1 similar comment
|
/pulsarbot rerun-failure-checks |
2f07608 to
97527e2
Compare
|
@lhotari @codelipenghui PTAL |
|
The pr had no activity for 30 days, mark with Stale label. |
97527e2 to
2126c83
Compare
2126c83 to
a6d6648
Compare
|
@Shawyeok Please add the following content to your PR description and select a checkbox: |
a6d6648 to
3660da4
Compare
|
/pulsarbot rerun-failure-checks |
pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java
Outdated
Show resolved
Hide resolved
|
/pulsarbot run-failure-checks |
| log.warn("Failed to authorize {} on topic {}", clientAppId, topicName); | ||
| authorizationFuture.completeExceptionally(new PulsarClientException( | ||
| String.format("Authorization failed %s on topic %s with error %s", | ||
| clientAppId, topicName, throwable2.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.
This is in the broker.
I thinks that we should split the path per component
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.
This is in the broker. I thinks that we should split the path per component
Sorry, could you please tell more specific? I'm guessing you are telling we shouldn't use exception class (PulsarClientException in here) that defined in the another component? Am I right?
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.
@eolivelli Could you explain in details? I'm also wondering what did you mean by split the path per component.
Codecov Report
@@ Coverage Diff @@
## master #15594 +/- ##
=========================================
Coverage ? 50.63%
Complexity ? 6992
=========================================
Files ? 383
Lines ? 41845
Branches ? 4272
=========================================
Hits ? 21190
Misses ? 18395
Partials ? 2260
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
/pulsarbot rerun-failure-checks |
|
The pr had no activity for 30 days, mark with Stale label. |
|
Since we will start the RC version of
So drag this PR to |
Motivation
Currently we are abuse
PulsarClientException, I think we could use a more meaningful derived exception instead. For example, callacknowledgeon an already closed consumer throws PulsarClientException with messageConsumer already closed, it's hard for caller to determine what kind of exception they catch.Modifications
It's safe to use a derived exception instead of PulsarClientException.
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
Check the box below or label this PR directly.
Need to update docs?
doc-not-neededMatching PR in forked repository
PR in forked repository: Shawyeok#3