use thiserror::Error;
#[derive(Debug, Error)]
pub enum JjHooksError {
#[error("jj exited with status {status}: {stderr}")]
JjFailed { status: i32, stderr: String },
#[error("setup step `{name}` exited with status {status}")]
SetupFailed { name: String, status: i32 },
#[error("could not parse `jj git push --dry-run` output: {0}")]
Parse(String),
#[error(
"hook runner `{bin}` could not be resolved.\n\
jj-hp looked at: (1) `jj-hooks.runner-bin.{bin}` config, \
(2) `.git/hooks/<stage>` shim from `prek install`, \
(3) `uv run --` when `uv.lock` + `uv` are present (prek/pre-commit only), \
(4) `$PATH`.\n\
hint: install it globally (e.g. `brew install {bin}` / `pipx install {bin}` / `uv tool install {bin}`), \
or set `jj-hooks.runner-bin.{bin} = \"…\"` in your jj config to point at the binary explicitly."
)]
RunnerNotFound { bin: String },
#[error(transparent)]
Io(#[from] std::io::Error),
}
pub type Result<T> = std::result::Result<T, JjHooksError>;