Skip to content

Conversation

@Shawyeok
Copy link
Contributor

@Shawyeok Shawyeok commented May 13, 2022

Motivation

Currently we are abuse PulsarClientException, I think we could use a more meaningful derived exception instead. For example, call acknowledge on an already closed consumer throws PulsarClientException with message Consumer 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

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-not-needed

Matching PR in forked repository

PR in forked repository: Shawyeok#3

Copy link
Contributor

@merlimat merlimat left a 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.

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 13, 2022
@Shawyeok
Copy link
Contributor Author

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.

@Technoboy- Technoboy- added this to the 2.11.0 milestone May 14, 2022
@Technoboy- Technoboy- added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/client labels May 14, 2022
@Shawyeok Shawyeok requested a review from merlimat May 14, 2022 11:23
@Shawyeok
Copy link
Contributor Author

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.

@merlimat Unit test added, PTAL

@Shawyeok
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@Shawyeok Shawyeok force-pushed the fix-throw-exception-type branch from 853a490 to 2020ab7 Compare May 15, 2022 04:27
@Shawyeok
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

1 similar comment
@Shawyeok
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@Shawyeok Shawyeok force-pushed the fix-throw-exception-type branch 2 times, most recently from 2f07608 to 97527e2 Compare May 24, 2022 14:18
@Shawyeok
Copy link
Contributor Author

@lhotari @codelipenghui PTAL

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Jun 24, 2022
@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.12.0 Jul 26, 2022
@Shawyeok Shawyeok force-pushed the fix-throw-exception-type branch from 97527e2 to 2126c83 Compare October 12, 2022 17:01
@Shawyeok Shawyeok changed the title [pulsar-client] Throw more meaningful derived exception instead of PulsarClientException [improve][pulsar-client] Throw more meaningful derived exception instead of PulsarClientException Oct 12, 2022
@Shawyeok Shawyeok changed the title [improve][pulsar-client] Throw more meaningful derived exception instead of PulsarClientException [improve][client] Throw more meaningful derived exception instead of PulsarClientException Oct 12, 2022
@Shawyeok Shawyeok force-pushed the fix-throw-exception-type branch from 2126c83 to a6d6648 Compare October 12, 2022 17:30
@github-actions github-actions bot added doc-label-missing and removed doc-not-needed Your PR changes do not impact docs labels Oct 12, 2022
@github-actions
Copy link

@Shawyeok Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@Shawyeok Shawyeok force-pushed the fix-throw-exception-type branch from a6d6648 to 3660da4 Compare October 12, 2022 17:53
@Shawyeok
Copy link
Contributor Author

Shawyeok commented Nov 1, 2022

/pulsarbot rerun-failure-checks

@tisonkun
Copy link
Member

/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())));
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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-commenter
Copy link

codecov-commenter commented Nov 14, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@92b4708). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #15594   +/-   ##
=========================================
  Coverage          ?   50.63%           
  Complexity        ?     6992           
=========================================
  Files             ?      383           
  Lines             ?    41845           
  Branches          ?     4272           
=========================================
  Hits              ?    21190           
  Misses            ?    18395           
  Partials          ?     2260           
Flag Coverage Δ
unittests 50.63% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@Shawyeok
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Dec 18, 2022
@tisonkun tisonkun requested a review from eolivelli December 18, 2022 02:15
@poorbarcode
Copy link
Contributor

Since we will start the RC version of 3.0.0 on 2023-04-11, I will change the label/milestone of PR who have not been merged.

  • The PR of type feature is deferred to 3.1.0
  • The PR of type fix is deferred to 3.0.1

So drag this PR to 3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/client doc-not-needed Your PR changes do not impact docs ready-to-test release/3.0.3 Stale type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.