Skip to content

Commit 559793d

Browse files
committed
fix: avoid exit when file content is not UTF8
1 parent 58163bf commit 559793d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/django-check_semantic/src/parser.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ impl Parser {
8787

8888
for entry in Self::python_files(dir) {
8989
let filename = Self::relative_path(dir, entry.path());
90-
let source = fs::read_to_string(entry.path())?;
90+
let source = match fs::read_to_string(entry.path()) {
91+
Ok(source) => source,
92+
Err(err) => {
93+
warn!(%err, source=%filename, "parsing file");
94+
continue;
95+
}
96+
};
9197
let graph = match self.build_graph(&source, &filename) {
9298
Ok(source) => source,
9399
Err(err) => {

0 commit comments

Comments
 (0)