use std::path::PathBuf;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("failed to bind HTTP listener on {addr}: {source}")]
Bind {
addr: String,
#[source]
source: std::io::Error,
},
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("failed to parse GSI payload: {0}")]
Parse(#[from] serde_json::Error),
#[error("could not locate Counter-Strike 2 installation: {0}")]
SteamDiscovery(String),
#[error("failed to write GSI cfg file at {path}: {source}")]
CfgWrite {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("listener has already been started")]
AlreadyStarted,
#[error("listener is not running")]
NotRunning,
}