Skip to content

Commit

Permalink
refactor: Update target SPM loading error handling in translation module
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Aug 3, 2024
1 parent 05fb748 commit fadcac4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/translation/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ int build_translation_context(struct translation_context &translation_ctx)
obs_log(LOG_INFO, "Loading target SPM from %s", target_spm_path.c_str());
translation_ctx.target_processor.reset(
new sentencepiece::SentencePieceProcessor());
const auto status = translation_ctx.target_processor->Load(target_spm_path);
if (!status.ok()) {
const auto target_status =
translation_ctx.target_processor->Load(target_spm_path);
if (!target_status.ok()) {
obs_log(LOG_ERROR, "Failed to load target SPM: %s",
status.ToString().c_str());
target_status.ToString().c_str());
return OBS_POLYGLOT_TRANSLATION_INIT_FAIL;
}
} else {
Expand Down

0 comments on commit fadcac4

Please sign in to comment.