Set content preview to null when response fails with exception#6589
Set content preview to null when response fails with exception#6589
Conversation
📝 WalkthroughWalkthroughThese changes add explicit null logging for response content previews in error scenarios and refactor the error response test suite to use parameterized testing with multiple server configurations for comprehensive behavior verification. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.java⚙️ CodeRabbit configuration file
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (7)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6589 +/- ##
============================================
- Coverage 74.46% 74.38% -0.08%
- Complexity 22234 23715 +1481
============================================
Files 1963 2128 +165
Lines 82437 88596 +6159
Branches 10764 11585 +821
============================================
+ Hits 61385 65903 +4518
- Misses 15918 17159 +1241
- Partials 5134 5534 +400 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation:
Following the discussion in #6570 (comment), content preview was being generated even when a preceding decorator failed with an exception. This behavior was inconsistent with
DefaultRequestLog, which sets the preview to null when an exception is present:armeria/core/src/main/java/com/linecorp/armeria/common/logging/DefaultRequestLog.java
Lines 1471 to 1473 in d068172
The content preview should not be recorded when the response flow is interrupted by an exception, as the decorator did not actually process the response content.
Modifications:
responseContentPreview(null)inContentPreviewingUtilwhenresponseContentPrevieweris null.responseContentPreview(null)inContentPreviewingServicewhen service execution throws an exception.Result: