Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Clean up exception handling in schedulers and models#5689

Open
yashhzd wants to merge 1 commit intoOWASP-BLT:mainfrom
yashhzd:fix/bare-except-models-and-unused-vars
Open

Clean up exception handling in schedulers and models#5689
yashhzd wants to merge 1 commit intoOWASP-BLT:mainfrom
yashhzd:fix/bare-except-models-and-unused-vars

Conversation

@yashhzd
Copy link
Contributor

@yashhzd yashhzd commented Feb 12, 2026

Clean up exception handling in schedulers and models

Changes

1. Bare except: in validate_image (models.py)

The image validator uses bare except: which catches SystemExit and KeyboardInterrupt. Changed to except Exception:.

2. Unused as e variables in scheduler commands

All four scheduler commands (run_daily, run_hourly, run_monthly, run_ten_minutes) catch exceptions with as e but never use the e variable — they use exc_info=True or f-string formatting instead. This triggers ruff F841 (unused variable).

run_daily.py — 10 occurrences of except Exception as e: where e is unused
run_hourly.py — 1 occurrence, also switched from f"Error: {e}" to logger.exception() for consistent traceback logging
run_monthly.py — 1 occurrence, same improvement
run_ten_minutes.py — 2 occurrences

Why this matters

  • Bare except: prevents graceful process shutdown (catches SystemExit, KeyboardInterrupt)
  • Unused as e is a lint warning that clutters code and signals intent to use the variable when it's actually ignored
  • logger.exception() automatically includes the traceback, making as e + f"{e}" redundant

- models.py: replace bare except: with except Exception: in
  validate_image to avoid catching SystemExit/KeyboardInterrupt
- run_daily.py: remove unused `as e` from 10 except clauses where
  exc_info=True is used instead (ruff F841)
- run_hourly.py: remove unused `as e`, use logger.exception for
  consistent traceback logging
- run_monthly.py: same as run_hourly
- run_ten_minutes.py: remove unused `as e` from 2 except clauses
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Warning

Rate limit exceeded

@yashhzd has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

👋 Hi @yashhzd!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbitai
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@github-actions github-actions bot added the needs-peer-review PR needs peer review label Feb 12, 2026
@github-actions
Copy link
Contributor

📊 Monthly Leaderboard

Hi @yashhzd! Here's how you rank for February 2026:

Rank User Open PRs PRs (merged) PRs (closed) Reviews Comments CR chats Total
#5 @S3DFX-CYBER 4 3 5 3 22 71 83
#6 @yashhzd 43 2 0 0 7 0 77
#7 @Nachiket-Roy 7 3 1 2 12 31 69

Scoring this month: Open PRs (+1 each), Merged PRs (+10), Closed (not merged) (−2), Reviews (+5; first two per PR in-month), Comments (+2, excludes CR). Coderabbit chats column is visible. Points per chat: 0; daily cap per user (UTC): 7.

@github-actions github-actions bot added pre-commit: passed Pre-commit checks passed tests: P:324 F:0 S:0 Django tests passed labels Feb 12, 2026
Copy link
Contributor

@Nachiket-Roy Nachiket-Roy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid

@github-actions github-actions bot added the last-active: 0d PR last updated 0 days ago label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 5 PR changes 5 files last-active: 0d PR last updated 0 days ago needs-peer-review PR needs peer review pre-commit: passed Pre-commit checks passed tests: P:324 F:0 S:0 Django tests passed

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants