diff --git a/crates/voicevox_core/src/error.rs b/crates/voicevox_core/src/error.rs index 551bd8c52..44451ece5 100644 --- a/crates/voicevox_core/src/error.rs +++ b/crates/voicevox_core/src/error.rs @@ -41,7 +41,7 @@ impl Error { ErrorRepr::GetSupportedDevices(_) => ErrorKind::GetSupportedDevices, ErrorRepr::StyleNotFound { .. } => ErrorKind::StyleNotFound, ErrorRepr::ModelNotFound { .. } => ErrorKind::ModelNotFound, - ErrorRepr::InferenceFailed => ErrorKind::InferenceFailed, + ErrorRepr::InferenceFailed { .. } => ErrorKind::InferenceFailed, ErrorRepr::ExtractFullContextLabel(_) => ErrorKind::ExtractFullContextLabel, ErrorRepr::ParseKana(_) => ErrorKind::ParseKana, ErrorRepr::LoadUserDict(_) => ErrorKind::LoadUserDict, @@ -80,7 +80,7 @@ pub(crate) enum ErrorRepr { ModelNotFound { model_id: VoiceModelId }, #[error("推論に失敗しました")] - InferenceFailed, + InferenceFailed(#[source] anyhow::Error), #[error(transparent)] ExtractFullContextLabel(#[from] FullContextLabelError), diff --git a/crates/voicevox_core/src/status.rs b/crates/voicevox_core/src/status.rs index 44c87c5f8..64a402683 100644 --- a/crates/voicevox_core/src/status.rs +++ b/crates/voicevox_core/src/status.rs @@ -185,7 +185,7 @@ impl Status { let output_tensors = predict_duration .run(vec![&mut phoneme_vector_array, &mut speaker_id_array]) - .map_err(|_| ErrorRepr::InferenceFailed)?; + .map_err(|e| ErrorRepr::InferenceFailed(e.into()))?; Ok(output_tensors[0].as_slice().unwrap().to_owned()) }) .await @@ -229,7 +229,7 @@ impl Status { &mut end_accent_phrase_vector_array, &mut speaker_id_array, ]) - .map_err(|_| ErrorRepr::InferenceFailed)?; + .map_err(|e| ErrorRepr::InferenceFailed(e.into()))?; Ok(output_tensors[0].as_slice().unwrap().to_owned()) }) .await @@ -261,7 +261,7 @@ impl Status { &mut phoneme_array, &mut speaker_id_array, ]) - .map_err(|_| ErrorRepr::InferenceFailed)?; + .map_err(|e| ErrorRepr::InferenceFailed(e.into()))?; Ok(output_tensors[0].as_slice().unwrap().to_owned()) }) .await