Skip to content

Commit

Permalink
Add a clearer panic message if settings.json is malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
cristian-paris committed Jan 27, 2025
1 parent b8a3f7b commit f394c0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/meta/src/cmd/install/install_debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ fn configure_vscode() {

let script_full_path = get_script_path(home::home_dir().unwrap().join(TARGET_PATH));
let json = fs::read_to_string(&path_to_settings).expect("Unable to read settings.json");
let mut sub_values: serde_json::Value = serde_json::from_str(&json).unwrap();
let mut sub_values: serde_json::Value = serde_json::from_str(&json).unwrap_or_else(
|err: serde_json::Error| panic!("Incorrectly formatted VSCode settings.json file. The error is locatted at line {}, column {}. This error might be caused either by a trailling comma in the settings file (which is, actually, pretty usual), or the settings file was not correctly edited and saved. Please check your file via a JSON linter and fix the settings file before attempting to run the install command again.", err.line(), err.column())
);

let init_commands = sub_values
.as_object_mut()
Expand Down

0 comments on commit f394c0b

Please sign in to comment.