chore: improve error message in some spots loading grammar.json

This commit is contained in:
Amaan Qureshi 2023-07-19 22:19:22 -04:00
parent 9a05739851
commit c521e9c18e
No known key found for this signature in database
GPG key ID: E67890ADC4227273
2 changed files with 6 additions and 2 deletions

View file

@ -61,7 +61,8 @@ pub fn generate_parser_in_directory(
None => {
let grammar_js_path = grammar_path.map_or(repo_path.join("grammar.js"), |s| s.into());
grammar_json = load_grammar_file(&grammar_js_path)?;
fs::write(&src_path.join("grammar.json"), &grammar_json)?;
fs::write(&src_path.join("grammar.json"), &grammar_json)
.with_context(|| format!("Failed to write grammar.json to {:?}", src_path))?;
}
}