Join GitHub today
Log S3 API error message #30126
When the S3 API returns for example code 403, it is hard to guess what went wrong without looking at the more verbose message, as seen for example in #29912.
When S3 API returns an error code in the 400 or 500 range, put message contents into debug log for easier troubleshooting.
Requests doesn't raise HTTPError automatically - for that raise_for_status() is commonly used. Therefore the try clause never caught any exceptions.
This change replaces the never activated except block with a response code check, as seen in utils/aws.py