Skip to content

Commit

Permalink
UnloadedModelModelNotFound (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip authored Sep 25, 2023
1 parent 38effe9 commit 4fe11f2
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 18 deletions.
7 changes: 0 additions & 7 deletions crates/voicevox_core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl Error {
LoadModelErrorKind::StyleAlreadyLoaded { .. } => ErrorKind::StyleAlreadyLoaded,
LoadModelErrorKind::InvalidModelData => ErrorKind::InvalidModelData,
},
ErrorRepr::UnloadedModel { .. } => ErrorKind::UnloadedModel,
ErrorRepr::GetSupportedDevices(_) => ErrorKind::GetSupportedDevices,
ErrorRepr::StyleNotFound { .. } => ErrorKind::StyleNotFound,
ErrorRepr::ModelNotFound { .. } => ErrorKind::ModelNotFound,
Expand All @@ -70,9 +69,6 @@ pub(crate) enum ErrorRepr {
#[error(transparent)]
LoadModel(#[from] LoadModelError),

#[error("Modelが読み込まれていません ({model_id:?})")]
UnloadedModel { model_id: VoiceModelId },

#[error("サポートされているデバイス情報取得中にエラーが発生しました,{0}")]
GetSupportedDevices(#[source] anyhow::Error),

Expand All @@ -82,7 +78,6 @@ pub(crate) enum ErrorRepr {
)]
StyleNotFound { style_id: StyleId },

#[allow(dead_code)] // FIXME
#[error(
"`{model_id}`に対する音声モデルが見つかりませんでした。読み込まれていないか、読み込みが既\
に解除されています"
Expand Down Expand Up @@ -131,8 +126,6 @@ pub enum ErrorKind {
StyleAlreadyLoaded,
/// 無効なモデルデータ。
InvalidModelData,
/// Modelが読み込まれていない。
UnloadedModel,
/// サポートされているデバイス情報取得に失敗した。
GetSupportedDevices,
/// スタイルIDに対するスタイルが見つからなかった。
Expand Down
2 changes: 1 addition & 1 deletion crates/voicevox_core/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl LoadedModels {

fn remove(&mut self, model_id: &VoiceModelId) -> Result<()> {
if self.0.remove(model_id).is_none() {
return Err(ErrorRepr::UnloadedModel {
return Err(ErrorRepr::ModelNotFound {
model_id: model_id.clone(),
}
.into());
Expand Down
4 changes: 0 additions & 4 deletions crates/voicevox_core_c_api/include/voicevox_core.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/voicevox_core_c_api/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub(crate) fn into_result_code_with_error(result: CApiResult<()>) -> VoicevoxRes
ModelAlreadyLoaded => VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR,
StyleAlreadyLoaded => VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR,
InvalidModelData => VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR,
UnloadedModel => VOICEVOX_RESULT_UNLOADED_MODEL_ERROR,
GetSupportedDevices => VOICEVOX_RESULT_GET_SUPPORTED_DEVICES_ERROR,
StyleNotFound => VOICEVOX_RESULT_STYLE_NOT_FOUND_ERROR,
ModelNotFound => VOICEVOX_RESULT_MODEL_NOT_FOUND_ERROR,
Expand Down
3 changes: 0 additions & 3 deletions crates/voicevox_core_c_api/src/result_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub enum VoicevoxResultCode {
VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR = 26,
/// 無効なモデルデータ
VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR = 27,
/// Modelが読み込まれていない
VOICEVOX_RESULT_UNLOADED_MODEL_ERROR = 19,
/// ユーザー辞書を読み込めなかった
VOICEVOX_RESULT_LOAD_USER_DICT_ERROR = 20,
/// ユーザー辞書を書き込めなかった
Expand Down Expand Up @@ -99,7 +97,6 @@ pub(crate) const fn error_result_to_message(result_code: VoicevoxResultCode) ->
VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR => {
cstr!("モデルデータを読むことができませんでした")
}
VOICEVOX_RESULT_UNLOADED_MODEL_ERROR => cstr!("Modelが読み込まれていません"),
VOICEVOX_RESULT_LOAD_USER_DICT_ERROR => cstr!("ユーザー辞書を読み込めませんでした"),
VOICEVOX_RESULT_SAVE_USER_DICT_ERROR => cstr!("ユーザー辞書を書き込めませんでした"),
VOICEVOX_RESULT_USER_DICT_WORD_NOT_FOUND_ERROR => {
Expand Down
1 change: 0 additions & 1 deletion crates/voicevox_core_c_api/tests/e2e/snapshots.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ result_messages.17 = "ZIP内のファイルを読むことができませんで
result_messages.18 = "同じIDのモデルを読むことはできません"
result_messages.26 = "同じIDのスタイルを読むことはできません"
result_messages.27 = "モデルデータを読むことができませんでした"
result_messages.19 = "Modelが読み込まれていません"
result_messages.20 = "ユーザー辞書を読み込めませんでした"
result_messages.21 = "ユーザー辞書を書き込めませんでした"
result_messages.22 = "ユーザー辞書に単語が見つかりませんでした"
Expand Down
1 change: 0 additions & 1 deletion crates/voicevox_core_c_api/tests/e2e/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ pub(crate) enum VoicevoxResultCode {
VOICEVOX_RESULT_MODEL_ALREADY_LOADED_ERROR = 18,
VOICEVOX_RESULT_STYLE_ALREADY_LOADED_ERROR = 26,
VOICEVOX_RESULT_INVALID_MODEL_DATA_ERROR = 27,
VOICEVOX_RESULT_UNLOADED_MODEL_ERROR = 19,
VOICEVOX_RESULT_LOAD_USER_DICT_ERROR = 20,
VOICEVOX_RESULT_SAVE_USER_DICT_ERROR = 21,
VOICEVOX_RESULT_USER_DICT_WORD_NOT_FOUND_ERROR = 22,
Expand Down

0 comments on commit 4fe11f2

Please sign in to comment.