pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][client] Throw more meaningful derived exception instead of PulsarClientException

Open Shawyeok opened this issue 2 years ago • 18 comments

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

  • [x] 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?

  • [x] doc-not-needed

Matching PR in forked repository

PR in forked repository: https://github.com/Shawyeok/pulsar/pull/3

Shawyeok avatar May 13 '22 15:05 Shawyeok

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.

Shawyeok avatar May 13 '22 16:05 Shawyeok

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 avatar May 14 '22 11:05 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar May 14 '22 13:05 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar May 23 '22 16:05 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar May 24 '22 02:05 Shawyeok

@lhotari @codelipenghui PTAL

Shawyeok avatar May 24 '22 17:05 Shawyeok

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

github-actions[bot] avatar Jun 24 '22 02:06 github-actions[bot]

@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 -->

github-actions[bot] avatar Oct 12 '22 17:10 github-actions[bot]

/pulsarbot rerun-failure-checks

Shawyeok avatar Oct 13 '22 11:10 Shawyeok

@codelipenghui Please help review this PR, thanks.

Shawyeok avatar Oct 13 '22 11:10 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar Oct 16 '22 17:10 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar Nov 01 '22 09:11 Shawyeok

/pulsarbot rerun-failure-checks

Shawyeok avatar Nov 01 '22 10:11 Shawyeok

/pulsarbot run-failure-checks

tisonkun avatar Nov 14 '22 06:11 tisonkun

Codecov Report

:exclamation: 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.

codecov-commenter avatar Nov 14 '22 16:11 codecov-commenter

/pulsarbot rerun-failure-checks

Shawyeok avatar Nov 17 '22 14:11 Shawyeok

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

github-actions[bot] avatar Dec 18 '22 01:12 github-actions[bot]

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

poorbarcode avatar Apr 10 '23 08:04 poorbarcode