Skip to content

Commit 999b12f

Browse files
committed
Ruby: better errors in generator
Provide more context if a file cannot be opened by the generator.
1 parent 7ee7a0d commit 999b12f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ruby/extractor/src/bin/generator.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,12 @@ fn main() -> std::io::Result<()> {
570570
node_types: tree_sitter_embedded_template::NODE_TYPES,
571571
},
572572
];
573-
let mut dbscheme_writer = LineWriter::new(File::create(dbscheme_path)?);
573+
574+
let dbscheme_file = File::create(dbscheme_path).map_err(|e| {
575+
tracing::error!("Failed to create dbscheme file: {}", e);
576+
e
577+
})?;
578+
let mut dbscheme_writer = LineWriter::new(dbscheme_file);
574579
write!(
575580
dbscheme_writer,
576581
"// CodeQL database schema for {}\n\
@@ -593,7 +598,11 @@ fn main() -> std::io::Result<()> {
593598
],
594599
)?;
595600

596-
let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
601+
let ql_library_file = File::create(ql_library_path).map_err(|e| {
602+
tracing::error!("Failed to create ql library file: {}", e);
603+
e
604+
})?;
605+
let mut ql_writer = LineWriter::new(ql_library_file);
597606
write!(
598607
ql_writer,
599608
"/**\n\

0 commit comments

Comments
 (0)