feat: add error.rs - #3
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA new core module and error subsystem introduce ChangesCore Error Handling Framework
Repository Metadata
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 8/10 reviews remaining, refill in 11 minutes and 27 seconds. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/core/error.rs (2)
85-86: ⚡ Quick winMake the public error enum forward-compatible with
#[non_exhaustive].Since this is a central public error type, future variant additions will otherwise require a breaking release.
Suggested diff
-#[derive(Debug, Clone, thiserror::Error)] +#[non_exhaustive] +#[derive(Debug, Clone, thiserror::Error)] pub enum AgentError {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/core/error.rs` around lines 85 - 86, Add the #[non_exhaustive] attribute to the public enum AgentError so new variants can be added without breaking semver: place #[non_exhaustive] immediately above the pub enum AgentError declaration (which currently has #[derive(Debug, Clone, thiserror::Error)]), then update any external exhaustive pattern matches to use a wildcard arm if needed.
299-344: ⚡ Quick winAdd unit tests for helper-method behavior contracts.
tool_not_foundtruncation formatting andis_recoverablevariant mapping are core policy decisions; lightweight tests here will prevent accidental regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/core/error.rs` around lines 299 - 344, Add unit tests verifying tool_not_found produces "none registered" when given an empty available slice, returns a comma-joined string when <=10 entries, and truncates with the "... (and N more)" format when >10 entries (assert on the exact formatted string); also add tests for is_recoverable that assert it returns true for AgentError::ToolExecution, AgentError::Api(...), AgentError::ContextExceeded, and AgentError::Reflection(...), and false for at least one non-recoverable variant (e.g., ToolNotFound or Cancel); place tests alongside the module tests (e.g., a tests mod in the same module) and construct AgentError instances via the tool_not_found constructor and the enum variants to validate behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/core/error.rs`:
- Around line 85-86: Add the #[non_exhaustive] attribute to the public enum
AgentError so new variants can be added without breaking semver: place
#[non_exhaustive] immediately above the pub enum AgentError declaration (which
currently has #[derive(Debug, Clone, thiserror::Error)]), then update any
external exhaustive pattern matches to use a wildcard arm if needed.
- Around line 299-344: Add unit tests verifying tool_not_found produces "none
registered" when given an empty available slice, returns a comma-joined string
when <=10 entries, and truncates with the "... (and N more)" format when >10
entries (assert on the exact formatted string); also add tests for
is_recoverable that assert it returns true for AgentError::ToolExecution,
AgentError::Api(...), AgentError::ContextExceeded, and
AgentError::Reflection(...), and false for at least one non-recoverable variant
(e.g., ToolNotFound or Cancel); place tests alongside the module tests (e.g., a
tests mod in the same module) and construct AgentError instances via the
tool_not_found constructor and the enum variants to validate behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 12bce791-7661-4b9d-9534-74981aefbc3f
📒 Files selected for processing (4)
Cargo.tomlsrc/core.rssrc/core/error.rssrc/lib.rs
56723a0 to
7be3534
Compare
No description provided.