Graceful errors instead of crashing (#1267)

This commit is contained in:
boatbomber 2026-06-01 20:02:39 -07:00 • committed by GitHub
parent 85655ca84f
commit 1abf675949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 167 additions and 99 deletions

View file

@ -195,7 +195,7 @@ struct LocalizationEntry<'a> {
/// https://github.com/BurntSushi/rust-csv/issues/151
///
/// This function operates in one step in order to minimize data-copying.
fn convert_localization_csv(contents: &[u8]) -> Result<String, csv::Error> {
fn convert_localization_csv(contents: &[u8]) -> anyhow::Result<String> {
let mut reader = csv::Reader::from_reader(contents);
let headers = reader.headers()?.clone();
@ -237,7 +237,7 @@ fn convert_localization_csv(contents: &[u8]) -> Result<String, csv::Error> {
}
let encoded =
serde_json::to_string(&entries).expect("Could not encode JSON for localization table");
serde_json::to_string(&entries).context("Could not encode JSON for localization table")?;
Ok(encoded)
}