Skip to content

Fix misleading error message in invokeIfBound#55

Merged
nlativy merged 1 commit into
masterfrom
fix-invokeifbound-error-message
Apr 27, 2026
Merged

Fix misleading error message in invokeIfBound#55
nlativy merged 1 commit into
masterfrom
fix-invokeifbound-error-message

Conversation

@nlativy
Copy link
Copy Markdown
Collaborator

@nlativy nlativy commented Apr 27, 2026

Summary

  • invokeIfBound is generic over a MethodReference, but its ReflectiveOperationException catch block hardcoded "Failed to invoke run on GuiceBerryEnvMain". It is also called for TestWrapper.toRunBeforeTest, TestScopeListener.enteringScope, and TestScopeListener.exitingScope, so the message was wrong in three of four call sites.
  • Build the message from the MethodReference so it names the actual class and method that failed.

Test plan

  • mvn clean test — all 43 tests pass

The catch block hardcoded "Failed to invoke run on GuiceBerryEnvMain",
but invokeIfBound is generic and is also called for TestWrapper and
TestScopeListener methods. Format the message from the MethodReference
instead so it names the actual class and method that failed.
@nlativy nlativy merged commit 93e2264 into master Apr 27, 2026
3 checks passed
@nlativy nlativy deleted the fix-invokeifbound-error-message branch April 27, 2026 20:23
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.

1 participant