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

feat: Include exception type in StatusReply toString when not text #31963

Conversation

johanandren
Copy link
Member

@johanandren johanandren commented Jun 5, 2023

Helps making test assertions easier to understand when using custom exception and they do not match as expected, this is what you can get currently:

java.lang.AssertionError: expected Error(text text text), found Error(text text text)

Copy link
Contributor

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

@octonato octonato left a comment

Choose a reason for hiding this comment

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

LGTM

@johanandren johanandren merged commit 29efef5 into akka:main Jun 5, 2023
6 checks passed
@johanandren johanandren deleted the wip-include-exception-type-in-statusreply-to-string branch June 5, 2023 09:57
@johanandren johanandren added this to the 2.8.3 milestone Jun 5, 2023
case ScalaFailure(ex) => s"Error(${ex.getMessage})"
case ScalaSuccess(t) => s"Success($t)"
case ScalaFailure(ex: ErrorMessage) => s"Error(${ex.getMessage})"
case ScalaFailure(ex) => s"Error(${ex.getClass.getName}: ${ex.getMessage})"
Copy link
Member

Choose a reason for hiding this comment

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

doesn't matter, but an alternative could have been ex.toString, which by default does pretty much the same thing but also handles the case of null message for NPE

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.

None yet

4 participants