You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you call default_storage.size(path_that_does_not_exists) with S3Boto3Storage as the default storage backend, it will raise botocore.exceptions.ClientError instead of FileNotFoundError.
The text was updated successfully, but these errors were encountered:
Thanks for checking this. I am not a boto expert but I was thinking may be we can check the response for the exception and see if the code is 404 and only then raise the FileNotFoundError.
Something like
try:
size = default_storage.size("does_not_exists.file")
except ClientError as e:
if e.response.get("Error", {}).get("Code", None) == '404':
raise FileNotFoundError("does_not_exists.file does not exist.")
else:
raise
When you call
default_storage.size(path_that_does_not_exists)
withS3Boto3Storage
as the default storage backend, it will raisebotocore.exceptions.ClientError
instead ofFileNotFoundError
.The text was updated successfully, but these errors were encountered: