Skip to content

Avoid assertion in finally block#235

Merged
exoego merged 1 commit intomasterfrom
avoid-assertion-in-finally
Jan 30, 2023
Merged

Avoid assertion in finally block#235
exoego merged 1 commit intomasterfrom
avoid-assertion-in-finally

Conversation

@exoego
Copy link
Contributor

@exoego exoego commented Jan 29, 2023

This is an issue found while working in #232.

Assertion in finally block is generally a not good idea.
Because it hides the real exception thrown in try block and makes debugging hard.

try {
  doSomething();   // unexpected exception thrown
  assertThat(...);
} finally {
  assertThat(...); // AssertionError is thrown, which hides the exception thrown from try block
}

@exoego exoego added the chore internal changes (not user-facing) label Jan 29, 2023
@exoego exoego marked this pull request as ready for review January 29, 2023 04:58
@exoego exoego merged commit 1ffa62b into master Jan 30, 2023
@exoego exoego deleted the avoid-assertion-in-finally branch January 30, 2023 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore internal changes (not user-facing)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants