Skip to main content

Error Handling and Testing

Logging

  • Do not use print() for logging.
  • Use logger.
  • Keep log messages concise, professional, and in English.
  • Include necessary context IDs when available.

Exception Handling

  • Do not use bare except:.
  • Do not use except Exception:.
  • Catch specific exceptions (for example TimeoutError, ValueError).
  • Do not use pass to silently ignore errors.
  • At minimum, log failures at ERROR level when handling exceptions.

Testing

  • Every behavior-changing PR must include or update targeted tests.
  • Prioritize changed behavior and risky edge cases over trivial getters/setters.
  • Do not overwrite local state (files/config/DB) implicitly in tests.
  • Use fixtures or temporary directories for isolated test state.
  • Default command: uv run pytest tests/.