Fix bare except handlers in keyword_extractor.py #20

Merged
llabeyrie merged 1 commits from fix/narrow-except-handlers into main 2026-03-19 18:39:36 +00:00
Owner

Summary

  • Narrow except Exception on YAKE import (line 202) to except ImportError
  • Narrow except Exception on YAKE extraction (line 211) to except (ValueError, TypeError)
  • Add logging with warnings so failures are no longer silently swallowed

Why

The bare except Exception handlers caught everything including KeyboardInterrupt, MemoryError, and SystemExit, and returned {} with no logging — making debugging impossible.

Test plan

  • python -c "import ast; ast.parse(...)" — syntax OK
  • python -m unittest -q — all 10 tests pass

Fixes #4

## Summary - Narrow `except Exception` on YAKE import (line 202) to `except ImportError` - Narrow `except Exception` on YAKE extraction (line 211) to `except (ValueError, TypeError)` - Add `logging` with warnings so failures are no longer silently swallowed ## Why The bare `except Exception` handlers caught everything including `KeyboardInterrupt`, `MemoryError`, and `SystemExit`, and returned `{}` with no logging — making debugging impossible. ## Test plan - [x] `python -c "import ast; ast.parse(...)"` — syntax OK - [x] `python -m unittest -q` — all 10 tests pass Fixes #4
llabeyrie added 1 commit 2026-03-19 18:32:25 +00:00
Replace broad `except Exception` with `except ImportError` for the yake
import and `except (ValueError, TypeError)` for YAKE extraction. Add
logging so failures are no longer silently swallowed.

Fixes #4
llabeyrie merged commit d97dadfb34 into main 2026-03-19 18:39:36 +00:00
llabeyrie deleted branch fix/narrow-except-handlers 2026-03-19 18:39:39 +00:00
Sign in to join this conversation.