use std::{path::PathBuf, time::Duration};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum LaunchError {
#[error("could not locate Chrome: {primary}; fallback lookup also failed: {fallback}")]
ChromeNotFound {
primary: String,
fallback: String,
},
#[error("explicit Chrome executable does not exist: {0}")]
ExecutableNotFound(PathBuf),
#[error("failed to create or access the Chrome profile directory: {source}")]
ProfileDirectory {
#[source]
source: std::io::Error,
},
#[error("failed to spawn Chrome: {source}")]
Spawn {
#[source]
source: std::io::Error,
},
#[error("failed to inspect Chrome process state: {source}")]
ProcessState {
#[source]
source: std::io::Error,
},
#[error("timed out after {timeout:?} waiting for {path}")]
DevToolsActivePortTimeout {
path: PathBuf,
timeout: Duration,
},
#[error("failed to read {path}: {source}")]
DevToolsActivePortRead {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("invalid DevToolsActivePort file at {path}")]
InvalidDevToolsActivePort {
path: PathBuf,
},
#[error("remote debugging pipe was requested but Chrome did not provide piped stdio")]
MissingPipeHandles,
#[error("Chrome exited before it became ready")]
ChromeExitedEarly,
}