mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Graceful errors instead of crashing (#1267)
This commit is contained in:
parent
85655ca84f
commit
1abf675949
17 changed files with 167 additions and 99 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue