pub enum HooksError {
HookNotFound(String),
InvalidConfiguration(String),
ExecutionFailed(String),
Timeout(u64),
HookDisabled(String),
StorageError(String),
ValidationError(String),
SubstitutionError(String),
ConditionError(String),
SerializationError(Error),
IoError(Error),
JsonError(Error),
}Expand description
Errors that can occur in the hooks system
This enum provides comprehensive error types for all operations in the hooks system. Each variant includes context about what went wrong and how to recover.
Variants§
HookNotFound(String)
Hook not found in the registry
This error occurs when trying to access a hook that doesn’t exist. The string contains the hook ID that was not found.
InvalidConfiguration(String)
Invalid hook configuration
This error occurs when hook configuration is invalid or malformed. The string contains details about what’s wrong with the configuration. Common causes:
- Missing required fields (event, action)
- Invalid action type
- Malformed YAML syntax
ExecutionFailed(String)
Hook execution failed
This error occurs when a hook action fails to execute. The string contains details about what went wrong. Note: Hook failures don’t affect other hooks (hook isolation).
Timeout(u64)
Hook execution timed out
This error occurs when a hook takes longer than the configured timeout. The u64 contains the timeout duration in milliseconds. Recovery: Increase timeout or optimize the hook action.
HookDisabled(String)
Hook is disabled
This error occurs when trying to execute a disabled hook.
The string contains the hook ID.
Recovery: Enable the hook using enable_hook().
StorageError(String)
Storage or registry error
This error occurs when there’s a problem with hook storage or registry operations. The string contains details about what went wrong. Common causes:
- Lock poisoning (concurrent access issue)
- File system errors
- Configuration file not found
ValidationError(String)
Configuration validation error
This error occurs when configuration validation fails. The string contains details about what validation failed. Common causes:
- Missing required fields
- Invalid field values
- Schema validation failure
SubstitutionError(String)
Variable substitution error
This error occurs when variable substitution in hook parameters fails. The string contains details about what variable is missing or invalid. Common causes:
- Missing variable in event context
- Invalid variable syntax
- Type mismatch in substitution
ConditionError(String)
Condition evaluation error
This error occurs when evaluating a hook condition fails. The string contains details about what went wrong. Common causes:
- Invalid condition expression
- Missing context variables
- Type mismatch in condition
SerializationError(Error)
Serialization error
This error occurs when serializing or deserializing configuration.
Wraps serde_yaml::Error for YAML parsing failures.
IoError(Error)
IO error
This error occurs when reading or writing files.
Wraps std::io::Error for file system operations.
JsonError(Error)
JSON error
This error occurs when working with JSON data.
Wraps serde_json::Error for JSON parsing failures.