Conversation
Pull Request ReviewSummaryThis PR improves exception messages for hook failures by including the original exception message in the wrapper exception. This addresses issues #3246 and #3374 where Visual Studio Test Explorer and other test runners were showing unhelpful generic messages like "BeforeTest hook failed" instead of the actual error. ✅ Positive Aspects
🔍 Observations & Considerations1. Message FormatThe current format works, but consider these edge cases:
2. Potential Enhancement (Optional)Consider whether to include exception type for additional clarity: throw new BeforeTestException($"BeforeTest hook failed with {ex.GetType().Name}: {ex.Message}", ex);3. AfterEveryTest Message DifferentiationLines 305 and 324 use slightly different messages ("After(Test)" vs "AfterEvery(Test)"). This is actually good - it provides more specific context about which hook type failed. 📊 Code Quality Assessment
🎯 RecommendationsRequired: None - the PR is ready to merge as-is. Optional Enhancements (can be done in future PRs if desired):
✅ Final VerdictAPPROVED - This is a well-focused improvement that directly addresses user-reported issues with minimal risk. The change is:
The PR successfully improves the developer experience when debugging hook failures in Visual Studio and other test runners. Note: Based on CLAUDE.md guidelines, this change:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances error messages for hook failures by including the original exception message in the wrapped exception. This improvement makes debugging hook failures significantly easier by immediately showing what went wrong without needing to inspect the inner exception.
Key Changes
- Updated exception messages for all hook types to include the original exception message using string interpolation
- Maintained the inner exception parameter to preserve full stack trace and exception details
- Applied changes consistently across all 10 hook types (BeforeTestSession, AfterTestSession, BeforeAssembly, AfterAssembly, BeforeClass, AfterClass, BeforeEveryTest, BeforeTest, BeforeTestDiscovery, AfterTestDiscovery)
Fixes #3246 #3374