mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Previously, the function would just return a presumed filename. Now that it actually checks s3, if the file doesn't exist it'll raise an exception. By default that's a StopIteration at the end of the bucket iterator, which isn't ideal as this will get supressed if the function is called within a generator loop further up or anything. There are a couple of places where we expect the file may not exist, so we define a custom exception to rescue specifically here. I did consider subclassing boto's ClientError, but this wasn't straightforward as the constructor expects to know the operation that failed, which for me is a signal that it's not an appropriate (re-)use of the class.