Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error::InferenceFailedにsourceとしてOrtErrorを持たせる #668

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/voicevox_core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -80,7 +80,7 @@ pub(crate) enum ErrorRepr {
ModelNotFound { model_id: VoiceModelId },

#[error("推論に失敗しました")]
InferenceFailed,
InferenceFailed(#[source] anyhow::Error),

#[error(transparent)]
ExtractFullContextLabel(#[from] FullContextLabelError),
Expand Down
6 changes: 3 additions & 3 deletions crates/voicevox_core/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down