Skip to content

Fix(compare): Handle missing items in CompareItemsHandler #323

Closed
Askeban wants to merge 2 commits intonlweb-ai:mainfrom
Askeban:main
Closed

Fix(compare): Handle missing items in CompareItemsHandler #323
Askeban wants to merge 2 commits intonlweb-ai:mainfrom
Askeban:main

Conversation

@Askeban
Copy link
Copy Markdown
Contributor

@Askeban Askeban commented Aug 20, 2025

This commit addresses an issue where the CompareItemsHandler would crash
with a KeyError if one or both of the items to be compared were not
found.

The fix involves the following changes:

  • Modified the do method in CompareItemsHandler to use .get() for
    safer dictionary access, preventing the KeyError.
  • Updated the _send_no_items_found_message method to send a more
    informative message, indicating which of the items were found.
  • Corrected a typo in a log message within the do method's exception
    handler.
  • Added a new test file test_compare_items.py with unit tests to
    cover scenarios where one or both items are not found.

These changes ensure that the system gracefully handles cases where
items are not found and provides better feedback to the user.

google-labs-jules bot and others added 2 commits August 20, 2025 09:58
This commit addresses an issue where the CompareItemsHandler would crash
with a KeyError if one or both of the items to be compared were not
found.

The fix involves the following changes:
- Modified the `do` method in `CompareItemsHandler` to use `.get()` for
  safer dictionary access, preventing the `KeyError`.
- Updated the `_send_no_items_found_message` method to send a more
  informative message, indicating which of the items were found.
- Corrected a typo in a log message within the `do` method's exception
  handler.
- Added a new test file `test_compare_items.py` with unit tests to
  cover scenarios where one or both items are not found.

These changes ensure that the system gracefully handles cases where
items are not found and provides better feedback to the user.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@rvguha
Copy link
Copy Markdown
Collaborator

rvguha commented Apr 5, 2026

Thanks for the contribution! Closing this as the codebase has changed significantly since this was opened (notably code/AskAgent/ restructure). If you'd like to revisit this, please feel free to open a fresh PR against the current main branch.

@rvguha rvguha closed this Apr 5, 2026
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.

2 participants