Skip to content

Commit 7eac73c

Browse files
committed
fix(codetide): add failsafe with GenericParser when main parser fails in _process_single_file
1 parent 581b2ad commit 7eac73c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

codetide/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,15 @@ async def _process_single_file(
293293
logger.debug(f"Processing file: {filepath}")
294294
return await parser.parse_file(filepath, self.rootpath)
295295
except Exception as e:
296-
logger.warning(f"Failed to process {filepath}: {str(e)}\n\n{traceback.format_exc()}")
297-
return None
296+
logger.warning(f"Failed to process {filepath} with parser {parser.__class__.__name__}: {str(e)}\n{traceback.format_exc()}")
297+
# Failsafe: try GenericParser
298+
try:
299+
logger.warning(f"Failsafe triggered: attempting to parse {filepath} with GenericParser.")
300+
generic_parser = GenericParser()
301+
return await generic_parser.parse_file(filepath, self.rootpath)
302+
except Exception as ge:
303+
logger.error(f"GenericParser also failed for {filepath}: {str(ge)}\n{traceback.format_exc()}")
304+
return None
298305

299306
def _add_results_to_codebase(
300307
self,

0 commit comments

Comments
 (0)