Skip to content

refactor: Enhance error handling in contest filters to log non-fatal warnings for missing categories and unrecognized wikis - #67

Merged
jhsoby merged 5 commits into
mainfrom
62-results-not-updated-if-a-category-given-in-criteria-doesnt-exist
Nov 21, 2025
Merged

refactor: Enhance error handling in contest filters to log non-fatal warnings for missing categories and unrecognized wikis#67
jhsoby merged 5 commits into
mainfrom
62-results-not-updated-if-a-category-given-in-criteria-doesnt-exist

Conversation

@DiFronzo

@DiFronzo DiFronzo commented May 24, 2025

Copy link
Copy Markdown
Member

Description

This PR adds enhanced error handling in contest filters, logging non-fatal warnings for missing categories and unrecognized wikis.

It has been tested, but there may still be edge cases I haven’t considered.

It will show in console like this:
Screenshot 2025-05-25 at 16 36 47
On wiki[1]:
Screenshot 2025-05-25 at 16 38 26

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore
  • ⏩ Revert

Related Tickets & Documents

Fixes #62

Tested?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📖 own file under the docs folder
  • 🙅 no documentation needed

[optional] Are there any pre- or post-deployment tasks we need to perform?

No

…warnings for missing categories and unrecognized wikis
@DiFronzo
DiFronzo requested a review from Copilot May 24, 2025 19:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

The PR refactors error handling in contest filters to log warnings instead of immediately failing for non-fatal issues such as missing categories or unrecognized wikis.

  • Replaces the direct category resolution with an iterative approach that logs warnings for missing categories.
  • Adds an extra validation loop for categories on unrecognized wikis, attaching corresponding warnings.
  • Updates contest rule extraction to differentiate between fatal errors and non-fatal warnings based on error message checks.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ukbot/filters.py Replaces direct list comprehension with iterative error logging for categories and adds validation for unrecognized wikis.
ukbot/contest.py Updates error handling in rule extraction to distinguish fatal errors from warnings.

Comment thread ukbot/filters.py Outdated
Comment thread ukbot/contest.py
DiFronzo and others added 4 commits May 24, 2025 22:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DiFronzo
DiFronzo marked this pull request as ready for review May 25, 2025 14:55
@jhsoby
jhsoby merged commit 0ea4141 into main Nov 21, 2025
@jhsoby
jhsoby deleted the 62-results-not-updated-if-a-category-given-in-criteria-doesnt-exist branch November 21, 2025 13:52
jhsoby pushed a commit that referenced this pull request Nov 21, 2025
…warnings for missing categories and unrecognized wikis (#67)

This PR adds enhanced error handling in contest filters, logging
non-fatal warnings for missing categories and unrecognized wikis.

It has been tested, but there may still be edge cases I haven’t
considered.

It will show in console like this:
![Screenshot 2025-05-25 at 16 36
47](https://github.com/user-attachments/assets/4f5310d5-3b61-4b74-a692-428b0e7babfa)
On
wiki[[1](https://no.wikipedia.org/w/index.php?title=Bruker:Premeditated/Sandkasse5&oldid=25156842)]:
![Screenshot 2025-05-25 at 16 38
26](https://github.com/user-attachments/assets/d31482eb-8ce0-464b-a4e2-f919ed04d93d)

- [ ] 🍕 Feature
- [X] 🐛 Bug Fix
- [ ] 📝 Documentation Update
- [ ] 🎨 Style
- [x] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [ ] ✅ Test
- [ ] 🤖 Build
- [ ] 🔁 CI
- [ ] 📦 Chore
- [ ] ⏩ Revert

Fixes #62

- [X] 👍 yes
- [ ] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

- [ ] 📜 README.md
- [ ] 📖 own file under the docs folder
- [X] 🙅 no documentation needed

perform?
No

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Results not updated if a category given in criteria doesn't exist

3 participants