talos_plugin/error.rs
1//! Error types for hook execution.
2
3use std::time::Duration;
4
5use thiserror::Error;
6
7/// Errors emitted by the hook runtime.
8#[derive(Debug, Clone, Error, PartialEq, Eq)]
9pub enum HookError {
10 /// A hook handler exceeded its execution timeout.
11 #[error("hook handler '{handler}' timed out after {timeout:?}")]
12 Timeout {
13 /// Handler name.
14 handler: String,
15 /// Timeout duration.
16 timeout: Duration,
17 },
18
19 /// A hook handler panicked while processing an event.
20 #[error("hook handler '{handler}' panicked")]
21 Panic {
22 /// Handler name.
23 handler: String,
24 },
25
26 /// A hook handler denied the current event.
27 #[error("hook handler '{handler}' denied event: {reason}")]
28 Denied {
29 /// Handler name.
30 handler: String,
31 /// Denial reason.
32 reason: String,
33 },
34}