aboutsummaryrefslogtreecommitdiffstats
path: root/crates/asist-core/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/asist-core/src/error.rs')
-rw-r--r--crates/asist-core/src/error.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/asist-core/src/error.rs b/crates/asist-core/src/error.rs
index b559bee..f0dfbe2 100644
--- a/crates/asist-core/src/error.rs
+++ b/crates/asist-core/src/error.rs
@@ -2,12 +2,12 @@ use std::fmt;
pub type Result<T> = std::result::Result<T, Error>;
-/// Un fallo de una etapa del pipeline. El orquestador decide si es fatal o si
-/// basta con abortar el turno en curso, así que el error lleva esa distinción
-/// en lugar de dejarla al criterio de quien lo recibe.
+/// A failure in a pipeline stage. The orchestrator decides whether it is
+/// fatal or whether aborting the current turn is enough, so the error carries
+/// that distinction instead of leaving it to whoever receives it.
#[derive(Debug, thiserror::Error)]
pub enum Error {
- #[error("configuración inválida: {0}")]
+ #[error("invalid configuration: {0}")]
Config(String),
#[error("audio: {0}")]
@@ -22,24 +22,24 @@ pub enum Error {
#[error("TTS: {0}")]
Tts(String),
- #[error("HTTP {status} en {url}: {body}")]
+ #[error("HTTP {status} at {url}: {body}")]
Http {
status: u16,
url: String,
body: String,
},
- #[error("transporte hacia {url}: {source}")]
+ #[error("transport to {url}: {source}")]
Transport {
url: String,
#[source]
source: std::io::Error,
},
- #[error("herramienta «{tool}»: {message}")]
+ #[error("tool «{tool}»: {message}")]
Tool { tool: String, message: String },
- #[error("operación cancelada")]
+ #[error("operation cancelled")]
Cancelled,
#[error(transparent)]
@@ -50,17 +50,17 @@ pub enum Error {
}
impl Error {
- /// Un error fatal tumba el asistente; el resto sólo aborta el turno.
+ /// A fatal error brings the assistant down; the rest only abort the turn.
///
- /// Los servidores locales se caen y se reinician, y el usuario prefiere
- /// oír «no te he entendido» a que el proceso muera, así que sólo la
- /// configuración y el audio (que no se pueden reintentar) son fatales.
+ /// The local servers crash and restart, and the user would rather hear «no
+ /// te he entendido» than have the process die, so only configuration and
+ /// audio (which cannot be retried) are fatal.
pub fn is_fatal(&self) -> bool {
matches!(self, Error::Config(_) | Error::Audio(_))
}
- /// `true` cuando reintentar tiene sentido: el servidor aún está cargando
- /// el modelo, o se ha caído la conexión a mitad de una petición.
+ /// `true` when retrying makes sense: the server is still loading the
+ /// model, or the connection dropped mid-request.
pub fn is_retryable(&self) -> bool {
match self {
Error::Transport { .. } => true,
@@ -70,7 +70,7 @@ impl Error {
}
}
-/// Contexto legible para los `Result` que cruzan una frontera de crate.
+/// Readable context for `Result`s that cross a crate boundary.
pub trait Context<T> {
fn ctx(self, f: impl FnOnce() -> String) -> Result<T>;
}