Files
imeai-aKode/akode-rs/app-server-daemon/src/start_error.rs
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +01:00

59 lines
1.6 KiB
Rust

//! Typed start failures for foreground callers. Nothing here is reported anywhere.
/// Failure of a foreground auto-start, with the original diagnostic kept separate from its reason.
#[derive(Debug)]
pub struct StartError {
pub error: anyhow::Error,
during_install: bool,
}
impl StartError {
pub fn failure_reason(&self) -> &'static str {
#[cfg(windows)]
if self.error.is::<crate::DetachedLaunchRestricted>() {
return "spawn";
}
match self.error.downcast_ref::<StartFailure>() {
Some(StartFailure::Spawn(_)) => "spawn",
Some(StartFailure::EarlyChildExit(_)) => "early_child_exit",
Some(StartFailure::ReadinessTimeout(_)) => "readiness_timeout",
None if self.during_install => "install",
None => "other",
}
}
pub(crate) fn install(error: anyhow::Error) -> Self {
Self {
error,
during_install: true,
}
}
}
impl From<anyhow::Error> for StartError {
fn from(error: anyhow::Error) -> Self {
Self {
error,
during_install: false,
}
}
}
/// Typed anyhow context preserves both the original diagnostic and downcasts through it.
#[derive(Debug)]
pub(crate) enum StartFailure {
Spawn(String),
EarlyChildExit(String),
ReadinessTimeout(String),
}
impl std::fmt::Display for StartFailure {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Spawn(message)
| Self::EarlyChildExit(message)
| Self::ReadinessTimeout(message) => f.write_str(message),
}
}
}