Skip to content
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

DefaultPromise may throw checked exceptions that are not advertised #8995

Merged
merged 1 commit into from
Apr 10, 2019

Conversation

normanmaurer
Copy link
Member

Motivation:

We should not throw check exceptions when the user calls sync*() but should better wrap it in a CompletionException to make it easier for people to reason about what happens.

Modifications:

  • Change sync*() to throw CompletionException
  • Adjust tests
  • Add some more tests

Result:

Fixes #8521.

Motivation:

We should not throw check exceptions when the user calls sync*() but should better wrap it in a CompletionException to make it easier for people to reason about what happens.

Modifications:

- Change sync*() to throw CompletionException
- Adjust tests
- Add some more tests

Result:

Fixes #8521.
@normanmaurer
Copy link
Member Author

/cc @njhill @franz1981

@normanmaurer
Copy link
Member Author

any comments ?

// expected
Assert.assertThat(expected.getCause(), CoreMatchers.instanceOf(RejectedExecutionException.class));
Copy link
Contributor

@franz1981 franz1981 Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for readability: import static CoreMatchers.instanceOf
or both is(instanceOf(...

Copy link
Contributor

@franz1981 franz1981 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with CancellationException, but it looks to be the same thing as ExecutionException except it is a RuntimeException. Seems fair.

+1 for trashing a usage of PlatformDependent.throwException(). I hate that thing :-)

@normanmaurer
Copy link
Member Author

@ejona86 yes CompletionException is basically the new ExecutionException but as RuntimeException :)

@normanmaurer normanmaurer merged commit 7c35781 into master Apr 10, 2019
Netty 5 automation moved this from In progress to Done Apr 10, 2019
@normanmaurer normanmaurer deleted the promise_future_exception branch April 10, 2019 05:15
@normanmaurer normanmaurer self-assigned this Apr 10, 2019
@@ -83,12 +83,20 @@
/**
* Waits for this future until it is done, and rethrows the cause of the failure if this future
* failed.
*
* @throws CancellationException if the computation was cancelled
* @throws {@link java.util.concurrent.CompletionException} if the computation threw an exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late, but this should be:

@throws CompletionException if the ....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trustin you mean removing the "package" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Netty 5
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants