Expand description
Error types for the hooks system
This module defines comprehensive error types for the hooks system with clear
error messages and context. All errors use the thiserror crate for ergonomic
error handling.
§Error Handling Patterns
The hooks system uses explicit error types to enable proper error recovery:
-
Hook Execution Errors: When a hook fails to execute, the error is logged but other hooks continue executing (hook isolation).
-
Configuration Errors: Invalid configuration is rejected with clear messages indicating what’s wrong and how to fix it.
-
Timeout Errors: Long-running hooks are terminated gracefully with a timeout error indicating how long the hook ran.
-
Storage Errors: Configuration loading failures are reported with context about which configuration file failed and why.
§Examples
Handling hook execution errors:
match executor.execute_hook(&hook, &context) {
Ok(result) => println!("Hook executed: {:?}", result),
Err(HooksError::Timeout(ms)) => eprintln!("Hook timed out after {}ms", ms),
Err(HooksError::ExecutionFailed(msg)) => eprintln!("Hook failed: {}", msg),
Err(e) => eprintln!("Error: {}", e),
}Enums§
- Hooks
Error - Errors that can occur in the hooks system
Type Aliases§
- Result
- Result type for hooks operations