feat: define common error types for each layer#2
Conversation
Each layer (rules, config, exec) needs structured error types to provide detailed diagnostics when things go wrong (e.g. pattern parse failures, config validation errors, sandbox issues). Using thiserror for derive and ensuring anyhow compatibility enables ergonomic error propagation across layer boundaries. Define the following error types: - Rules: PatternParseError, CommandParseError, RuleError, ExprError - Config: ConfigError, PresetError - Exec: ExecError, SandboxError, ExtensionError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @fohte, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request establishes a robust error handling foundation across the application's core layers: rules, configuration, and execution. It standardizes error reporting and propagation using the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request does an excellent job of establishing a solid foundation for error handling across different layers of the application. The use of thiserror and anyhow is idiomatic and well-executed. The new error types are well-defined, and the test coverage is comprehensive, including checks for error chaining with anyhow. I have one suggestion in src/rules/error.rs to further improve the error wrapping consistency.
…nsistency RuleError::ExprEval(String) forced callers to format ExprError into a string, losing structured error information and breaking the error chain. Wrapping ExprError with #[from] is consistent with how PatternParseError and CommandParseError are handled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-task-1-2 # Conflicts: # Cargo.lock # Cargo.toml
Why
thiserror+anyhowpreserves error chains while propagating errors across layer boundariesWhat
thiserror-derived error types for rules, config, and exec layers, with 54 tests verifyinganyhowcompatibilityPatternParseError,CommandParseError,RuleError,ExprErrorConfigError,PresetErrorExecError,SandboxError,ExtensionError