-
Notifications
You must be signed in to change notification settings - Fork 13k
chore: use err for logging Error instances on voip code
#37794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughStandardized error variable naming across media-calls system by renaming catch block parameters from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (1)📚 Learning: 2025-11-19T18:20:37.116ZApplied to files:
🧬 Code graph analysis (1)apps/meteor/server/services/media-call/service.ts (1)
⏰ 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). (2)
🔇 Additional comments (1)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (1)
170-178: Inconsistent error variable naming.The catch parameter remains
error(line 170), but the logger useserr: error(line 172). This is inconsistent with the standardization pattern applied in other catch blocks (lines 227, 298, 364) within this same file. Consider renaming the catch parameter toerrfor consistency.Apply this diff:
- } catch (error) { + } catch (err) { this.sipDialog = null; - logger.error({ msg: 'OutgoingSipCall.createDialog - failed to create sip dialog', err: error, callId: call._id }); - const errorCode = this.getSipErrorCode(error); + logger.error({ msg: 'OutgoingSipCall.createDialog - failed to create sip dialog', err, callId: call._id }); + const errorCode = this.getSipErrorCode(err); if (errorCode) { void mediaCallDirector.hangupByServer(call, `sip-error-${errorCode}`); this.cancelAnyPendingRequest(); return; } }
🧹 Nitpick comments (1)
ee/packages/media-calls/src/server/MediaCallServer.ts (1)
79-84: Consider renaming the catch parameter for consistency.The logger now uses
err: error(line 84), but the catch parameter remainserror(line 79). For consistency with the rest of the codebase (e.g., Session.ts, service.ts), consider renaming the catch parameter toerrand updating all references within the catch block (lines 82, 84, 99).Apply this diff for consistency:
- } catch (error) { + } catch (err) { let rejectionReason: CallRejectedReason = 'unsupported'; - if (error && typeof error === 'object' && error instanceof CallRejectedError) { - rejectionReason = error.callRejectedReason; + if (err && typeof err === 'object' && err instanceof CallRejectedError) { + rejectionReason = err.callRejectedReason; } else { - logger.error({ msg: 'Failed to create a requested call', params, err: error }); + logger.error({ msg: 'Failed to create a requested call', params, err }); } const originalId = params.requestedCallId || params.parentCallId; if (originalId && params.requestedBy?.type === 'user') { logger.info({ msg: 'Call Request Rejected', uid: params.requestedBy.id, rejectionReason }); this.sendSignal(params.requestedBy.id, { type: 'rejected-call-request', callId: originalId, toContractId: params.requestedBy.contractId, reason: rejectionReason, }); } else { - throw error; + throw err; } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
.changeset/hot-pumpkins-agree.md(1 hunks)apps/meteor/server/services/media-call/service.ts(7 hunks)ee/packages/media-calls/src/server/CallDirector.ts(7 hunks)ee/packages/media-calls/src/server/MediaCallServer.ts(2 hunks)ee/packages/media-calls/src/sip/Session.ts(3 hunks)ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts(3 hunks)ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
ee/packages/media-calls/src/server/MediaCallServer.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tsee/packages/media-calls/src/sip/providers/OutgoingSipCall.tsee/packages/media-calls/src/server/CallDirector.tsee/packages/media-calls/src/sip/Session.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.
Applied to files:
ee/packages/media-calls/src/server/MediaCallServer.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tsee/packages/media-calls/src/server/CallDirector.tsee/packages/media-calls/src/sip/Session.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
Applied to files:
.changeset/hot-pumpkins-agree.md
🧬 Code graph analysis (4)
ee/packages/media-calls/src/server/MediaCallServer.ts (1)
ee/packages/media-calls/src/logger.ts (1)
logger(3-3)
ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
ee/packages/media-calls/src/logger.ts (1)
logger(3-3)
ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (1)
ee/packages/media-calls/src/logger.ts (1)
logger(3-3)
ee/packages/media-calls/src/sip/Session.ts (1)
ee/packages/media-calls/src/logger.ts (1)
logger(3-3)
⏰ 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). (2)
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (7)
.changeset/hot-pumpkins-agree.md (1)
1-6: LGTM!The changeset properly documents the patch-level changes and clearly describes the fix for VoIP error logging.
apps/meteor/server/services/media-call/service.ts (1)
46-47: LGTM! Consistent error variable standardization.All catch blocks have been consistently updated to use
errinstead oferror, and the logger calls properly reference the renamed variable. The re-throw at line 329 correctly propagates the error after logging.Also applies to: 58-59, 64-65, 72-73, 132-133, 143-144, 176-177, 206-207, 327-329
ee/packages/media-calls/src/sip/Session.ts (1)
50-51: LGTM! Error handling standardized correctly.The catch blocks and error handler parameter have been consistently renamed to
err, with all logger calls properly updated.Also applies to: 143-144, 192-193
ee/packages/media-calls/src/server/MediaCallServer.ts (1)
51-52: LGTM! Consistent error variable naming.The catch block correctly uses
errand the logger call is properly updated.ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
175-176: LGTM! Error handling standardized correctly.All catch blocks have been consistently updated to use
err, with logger calls properly referencing the renamed variable.Also applies to: 263-264, 368-369
ee/packages/media-calls/src/server/CallDirector.ts (1)
119-121: LGTM! Comprehensive error handling standardization.All catch blocks have been consistently updated to use
err, including those with re-throws. Error propagation is correctly maintained, and logger calls properly reference the renamed variable throughout.Also applies to: 306-307, 324-324, 331-345, 361-369, 392-392, 416-417
ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (1)
227-228: LGTM! Error handling standardized correctly.These catch blocks have been consistently updated to use
err, with logger calls properly referencing the renamed variable.Also applies to: 298-299, 364-365
err for logging Error instances on voip code
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #37794 +/- ##
===========================================
- Coverage 67.80% 67.72% -0.09%
===========================================
Files 3458 3458
Lines 113955 113953 -2
Branches 20927 20926 -1
===========================================
- Hits 77271 77169 -102
- Misses 34553 34654 +101
+ Partials 2131 2130 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Issue(s)
VGA-110
Steps to test or reproduce
Further comments
Errorinstances are not inherently serializable. Pino will serialize them for us, but only if they are in an attribute namederr.Summary by CodeRabbit
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.