fix: replace bare except clauses with except Exception in ingest.py#5
fix: replace bare except clauses with except Exception in ingest.py#5harshadkhetpal wants to merge 43 commits into
Conversation
…rade AI with Verifiable Attribution.pdf
JiwaniZakir
left a comment
There was a problem hiding this comment.
The change from bare except: to except Exception: is correct and prevents accidentally swallowing KeyboardInterrupt, SystemExit, and GeneratorExit. That said, several of these handlers could be narrowed further to improve debuggability — for example, the os.remove(log_path) call in trigger_graphrag_index_with_progress around line 642 realistically only needs to handle FileNotFoundError or PermissionError, and the pd.read_parquet calls (lines 561, 720, 838) could catch FileNotFoundError or pyarrow/fastparquet exceptions specifically. All of these except Exception: pass blocks silently discard errors with no logging, which makes diagnosing failures in production difficult — even a logging.debug(exc_info=True) would significantly improve observability. The get_last_run_id function is a good candidate for tighter handling since a failure there likely means the log file is malformed or missing, which are distinguishable and actionable conditions worth surfacing.
7df032c to
9cdd15d
Compare
Summary
Replace 5 bare
except:clauses withexcept Exception:ingraphrag-ollama-config/ingest.py(lines 183, 236, 561, 642, 696). Bare excepts catch all exceptions includingSystemExit,KeyboardInterrupt, andGeneratorExit, which should generally propagate.Change:
Testing
No behavior change for normal exceptions — style/correctness fix per PEP 8.