fix: improve error message when the tree-sitter field is malformed
This commit is contained in:
parent
ac19638f71
commit
517e61b3e6
1 changed files with 3 additions and 1 deletions
|
|
@ -468,7 +468,9 @@ fn lookup_package_json_for_path(path: &Path) -> Result<(PathBuf, PackageJSON)> {
|
|||
.then(|| -> Result<PackageJSON> {
|
||||
let file =
|
||||
File::open(pathbuf.as_path()).with_context(|| "Failed to open package.json")?;
|
||||
Ok(serde_json::from_reader(BufReader::new(file))?)
|
||||
serde_json::from_reader(BufReader::new(file)).context(
|
||||
"Failed to parse package.json, is the `tree-sitter` section malformed?",
|
||||
)
|
||||
})
|
||||
.transpose()?;
|
||||
if let Some(package_json) = package_json {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue