Use generic error handling for 4XX empty responses
Problem
When AWS services return 4XX errors with empty bodies, users receive XML parsing errors instead of meaningful HTTP status messages. For example, service returns HTTP 413 with an empty body when request size limits are exceeded, but users see:
botocore.parsers.ResponseParserError: Unable to parse response (no element found: line 1, column 0), invalid XML received.
Solution
This PR extends generic error handling from 5XX to 4XX status codes, preventing parsing failures and surfacing the actual HTTP error, for example:
botocore.exceptions.ClientError: An error occurred (413) when calling the PutDashboard operation: Content Too Large
Backwards Compatibility
- Preserves all existing 5XX behavior
- Only affects 4XX responses with empty/HTML bodies that would previously cause parsing failures
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.67%. Comparing base (8121342) to head (4505021).
:warning: Report is 176 commits behind head on develop.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## develop #3602 +/- ##
===========================================
- Coverage 93.17% 92.67% -0.50%
===========================================
Files 68 68
Lines 15411 15573 +162
===========================================
+ Hits 14359 14433 +74
- Misses 1052 1140 +88
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.