fix(server): map ERROR_CODE_CANCELLED to gRPC Canceled not Internal#2978
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds explicit error-code-to-gRPC-status mapping in the ChangesError code to gRPC status mapping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@EgeAytin @ucatbas @tolgaozen, have a look when you get chance and lmk for any required changes |
|
I have read the CLA Document and I hereby sign the CLA |
|
@omer-topal , can you have a look when you get chance, and lmk if any changes needed |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (74.65%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## master #2978 +/- ##
==========================================
- Coverage 82.58% 74.65% -7.93%
==========================================
Files 74 83 +9
Lines 8300 9212 +912
==========================================
+ Hits 6854 6876 +22
- Misses 910 1800 +890
Partials 536 536 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Problem
GetStatus maps all 5xxx error codes to codes.Internal via a range check.
This incorrectly includes ERROR_CODE_CANCELLED (5001), so every context cancellation is logged as ERROR-level ,rpc error: code = Internal desc = ERROR_CODE_CANCELLED, by gRPC interceptors, flooding production logs in distributed mode.
Fix
Added explicit cases before the range fallthrough:
Added error_test.go with 9 test cases.
Closes #2700
Summary by CodeRabbit
Bug Fixes
Tests