From c1bd227ffb79b2a29d72e99b76795b80b451d54b Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Tue, 31 Oct 2023 01:15:30 +0900 Subject: [PATCH] =?UTF-8?q?`Error::InferenceFailed`=E3=81=ABsource?= =?UTF-8?q?=E3=81=A8=E3=81=97=E3=81=A6`OrtError`=E3=82=92=E6=8C=81?= =?UTF-8?q?=E3=81=9F=E3=81=9B=E3=82=8B=20(#668)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core/src/error.rs | 4 ++-- crates/voicevox_core/src/status.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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