Skip to content

Commit

Permalink
Error::InferenceFailedにsourceとしてOrtErrorを持たせる (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip authored Oct 30, 2023
1 parent 322e011 commit c1bd227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit c1bd227

Please sign in to comment.