Skip to content

Conversation

cp90-pixel
Copy link

Summary

  • Wrapped stylesheet, emoji, and widget media uploads in try/except blocks so AWS HTTP failures raise prawcore.ServerError instead of surfacing raw HTTPError exceptions.

  • Added regression tests covering 500 responses for stylesheet assets, emoji uploads, and widget image uploads to guarantee these helpers emit ServerError exceptions.

Testing

✅ python -m pytest tests/unit/models/reddit/test_subreddit.py tests/unit/models/reddit/test_emoji.py tests/unit/models/reddit/test_widgets.py

Fixes issue #1825

response.raise_for_status()
try:
response.raise_for_status()
except HTTPError as err:
Copy link
Member

Choose a reason for hiding this comment

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

Could you call this error please here and in the other locations.

http_response.status_code = 500

response = mock.Mock()
response.ok = True
Copy link
Member

Choose a reason for hiding this comment

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

Is this line necessary?

Copy link
Member

@bboe bboe left a comment

Choose a reason for hiding this comment

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

Looks like a solid improvement. It'll require a major version bump, but we're coming up on that anyway so I think that's fine. Could you please add changelog entries explaining the change in exceptions raises for these methods?

Thanks!

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