Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a clearer panic message if settings.json is malformed #1939

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading