From 90da778eda67363992de28aa30af7987c2ecfc38 Mon Sep 17 00:00:00 2001 From: Nicholas Lativy Date: Mon, 27 Apr 2026 20:54:40 +0100 Subject: [PATCH] Fix misleading error message in invokeIfBound 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. --- .../java/com/google/acai/GuiceberryCompatibilityModule.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/acai/GuiceberryCompatibilityModule.java b/src/main/java/com/google/acai/GuiceberryCompatibilityModule.java index dd21088..4ebeccd 100644 --- a/src/main/java/com/google/acai/GuiceberryCompatibilityModule.java +++ b/src/main/java/com/google/acai/GuiceberryCompatibilityModule.java @@ -100,7 +100,8 @@ private static void invokeIfBound(Injector injector, MethodReference method) thr } catch (InvocationTargetException e) { throw e.getCause(); } catch (ReflectiveOperationException e) { - throw new RuntimeException("Failed to invoke run on GuiceBerryEnvMain", e); + throw new RuntimeException( + "Failed to invoke " + method.methodName() + " on " + method.className(), e); } }