Skip to content

Exceptions Documentation and Testing #479

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

Merged
merged 1 commit into from
Mar 21, 2018
Merged

Exceptions Documentation and Testing #479

merged 1 commit into from
Mar 21, 2018

Conversation

nebhale
Copy link
Member

@nebhale nebhale commented Mar 19, 2018

This change adds Javadocs and tests to the exception hierarchy in rsocket-core. This change introduces the first JUnit 5 tests (and a fancy test interface!) as well as using AssertJ to make the assertions more fluent and understandable.

NOTE: There are a couple of API incompatibilities in this change, and if any of them are objectionable, I'm happy to revert them.

  1. Some of the exceptions were renamed (e.g. CancelException was renamed to CanceledException) to match the spec naming and to conform to the naming style of the other exceptions.
  2. NoAvailableRSocketException, TimeoutException and TransportException were only used in the reactor-load-balancer project. In an effort to keep them local to their usage, and to ensure that reactor-core stays as spec-focused as possible, these types were moved to the reactor-load-balancer project.

@robertroeser
Copy link
Member

LGTM

probably have @yschimke look too

@nebhale
Copy link
Member Author

nebhale commented Mar 19, 2018

Forgot some tests. 😄

Copy link
Member

@smaldini smaldini left a comment

Choose a reason for hiding this comment

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

LGTM

super(message, cause);
super(
Objects.requireNonNull(message, "message must not be null"),
Objects.requireNonNull(cause, "cause must not be null"));
Copy link
Member

Choose a reason for hiding this comment

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

nit: this seems overly strict given that cause in RuntimeException is nullable. As it's in error handling code, being super strict here is likely to just translate some business errors into rarely seen NPE.

Copy link
Member Author

Choose a reason for hiding this comment

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

I’d wondered about this as I did it. Specifically, this was codifying existing intent. I’m happy to remove if you think that it the intent was inaccurate.

Copy link
Member

Choose a reason for hiding this comment

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

My concern wouldn't be with the ApplicationException created by users of the library ever passing in something like

new ApplicationException("failed reading from DB", e.getCause())

I'd weakly vote for removing, but wouldn't fight to the death over it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@yschimke I'd agree with you, and since I haven't seen any objections here I'll update.

Copy link
Member

@yschimke yschimke left a comment

Choose a reason for hiding this comment

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

consider relaxing the NPE for cause == null, I understand the reasoning, but it means checking for nulls in more cases and only loses information at runtime.

This change adds Javadocs and tests to the exception hierarchy in rsocket-
core.  This change introduces the first JUnit 5 tests (and a fancy test
interface!) as well as using AssertJ to make the assertions more fluent and
understandable.
@yschimke yschimke merged commit 6a720a9 into rsocket:1.0.x Mar 21, 2018
@nebhale nebhale deleted the exceptions branch March 21, 2018 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants