Skip to content

Better handling of requests errors#15

Merged
bmwant merged 8 commits intomainfrom
handle-requests-errors
Sep 12, 2025
Merged

Better handling of requests errors#15
bmwant merged 8 commits intomainfrom
handle-requests-errors

Conversation

@bmwant
Copy link
Owner

@bmwant bmwant commented Sep 11, 2025

Description

  • Add message is something goes wrong during the api calls
  • Improve ux by decreasing default timeout time

@bmwant bmwant requested a review from Copilot September 12, 2025 08:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error handling for API requests and enhances user experience by adding request timeout configuration and better error messaging.

  • Add error handling decorator for HTTP requests with user-friendly messages
  • Reduce default timeout to 5 seconds for better responsiveness
  • Add comprehensive test coverage for parser functions with test data fixtures

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
leak/utils.py Introduces new error handling decorator and context manager utilities
leak/main.py Applies error handling decorator to API functions and adds timeout configuration
leak/settings.py Adds REQUESTS_TIMEOUT configuration setting
leak/parser.py Refactors email/author parsing with improved shared email handling
tests/test_parser.py Adds comprehensive test cases for parser functions
tests/conftest.py Adds test fixtures for package and download data
tests/data/aiohttp_package_data.json Test data for parser function validation
pyproject.toml Version bump and dependency updates
.pre-commit-config.yaml Updates pre-commit hook versions
leak/ui.py Removes debug print statement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +63 to +67
author = author_line
if all(parsed):
author = parsed[0]

return decode_name(author)
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The function calls decode_name(author) but author could be the original author_line string when all(parsed) is False. The decode_name function expects email header encoded data, but author_line might not be encoded, causing potential decoding errors.

Suggested change
author = author_line
if all(parsed):
author = parsed[0]
return decode_name(author)
if all(parsed):
return decode_name(parsed[0])
else:
return author_line

Copilot uses AI. Check for mistakes.
@bmwant bmwant merged commit c50e9b5 into main Sep 12, 2025
5 checks passed
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