Skip to content

Commit

Permalink
return err instead of panic
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed May 23, 2023
1 parent 68eb388 commit a5e5eaa
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions tooling/bundler/src/bundle/windows/nsis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,14 @@ fn build_nsis_app_installer(
}),
);

let languages_data = languages
.iter()
.filter_map(|lang| {
match get_lang_data(lang, custom_language_files.as_ref()) {
Ok(Some(data)) => Some(data),
Ok(None) => {
log::warn!("Custom tauri messages for {lang} are not translated.\nIf it is a valid language listed on <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files>, please open a Tauri feature request\n or you can provide a custom language file for it in `tauri.conf.json > tauri > bundle > windows > nsis > custom_language_files`");
None
} ,
Err(e) => panic!("{e}")
let mut languages_data = Vec::new();
for lang in &languages {
if let Some(data) = get_lang_data(lang, custom_language_files.as_ref())? {
languages_data.push(data);
} else {
log::warn!("Custom tauri messages for {lang} are not translated.\nIf it is a valid language listed on <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files>, please open a Tauri feature request\n or you can provide a custom language file for it in `tauri.conf.json > tauri > bundle > windows > nsis > custom_language_files`");
}
}).collect::<Vec<_>>();
}

data.insert("languages", to_json(languages.clone()));
data.insert(
Expand Down

0 comments on commit a5e5eaa

Please sign in to comment.