Repository navigation
assert supports cause - #1232
Conversation
WalkthroughCompiler target updated to ES2022. The assert utility gains an optional cause parameter to include underlying error causes when throwing. Unit tests are extended to cover the new cause behavior and import the assert function for testing. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Caller
participant U as utils.assert
participant E as Error
C->>U: assert(condition, message, isWarn=false, cause?)
alt condition is true
U-->>C: returns
else condition is false and isWarn is true
U-->>C: logs/warns and returns
else condition is false and isWarn is false
alt cause provided
U->>E: new Error(message, { cause })
else no cause
U->>E: new Error(message)
end
U--xC: throws Error
end
note over U,E: Throw path now includes optional cause
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code graph analysis (1)packages/graphai/src/utils/utils.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 (5)
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 |
Summary by CodeRabbit