grok-build-upstream-mirror/crates/codegen/xai-grok-hooks/src/error.rs
grokkybara[bot] ba76b0a683 Synced from monorepo
Changes:
- Stop hooks for session lifecycle
- Add x.ai/session/state and x.ai/session/import ACP methods
- Deny-and-continue for auto-mode classifier blocks with denial limits
- Drop codebase-upload from dhat soak test
- scheduler_create upsert via task_id; retire one-shot tasks
- Clipboard: copy file fallback + honest toasts for SSH/Apple Terminal
- Polarity-safe syntax colors in minimal mode
- Auto mode classifies unvetted env prefixes instead of hard-prompting
- Add GROK_CLIPBOARD_NO_OSC52 kill switch to force OSC 52 off
2026-07-19 18:42:24 +01:00

52 lines
1.4 KiB
Rust

use std::path::PathBuf;
/// Errors that can occur during hook loading, parsing, or execution.
#[derive(Debug, thiserror::Error)]
pub enum HookError {
#[error("failed to read hook file {path}: {source}")]
ReadFile {
path: PathBuf,
source: std::io::Error,
},
#[error("failed to parse hook file {path}: {detail}")]
ParseFile { path: PathBuf, detail: String },
#[error("hook {name} in {path}: invalid regex pattern: {source}")]
InvalidMatcher {
name: String,
path: PathBuf,
source: regex::Error,
},
#[error("hook {name} timed out after {elapsed_ms}ms")]
Timeout { name: String, elapsed_ms: u64 },
#[error("hook {name} command failed: {source}")]
CommandFailed {
name: String,
source: std::io::Error,
},
#[error("hook {name} produced invalid output: {detail}")]
InvalidOutput { name: String, detail: String },
#[error("hook {name}: command not found or not executable: {path}")]
CommandNotFound { name: String, path: PathBuf },
#[error("hook {name} in {path}: {detail}")]
InvalidConfig {
name: String,
path: PathBuf,
detail: String,
},
#[error(
"hook {name} in {path}: unsupported handler type '{handler_type}', expected 'command' or 'http'"
)]
UnsupportedHandlerType {
name: String,
path: PathBuf,
handler_type: String,
},
}