Wrapper function for s3 requests in order to create more helpful error messages.
(func)
| 125 | |
| 126 | |
| 127 | def s3_request(func): |
| 128 | """ |
| 129 | Wrapper function for s3 requests in order to create more helpful error |
| 130 | messages. |
| 131 | """ |
| 132 | |
| 133 | @wraps(func) |
| 134 | def wrapper(url, *args, **kwargs): |
| 135 | try: |
| 136 | return func(url, *args, **kwargs) |
| 137 | except ClientError as exc: |
| 138 | if int(exc.response["Error"]["Code"]) == 404: |
| 139 | raise EnvironmentError("file {} not found".format(url)) |
| 140 | else: |
| 141 | raise |
| 142 | |
| 143 | return wrapper |
| 144 | |
| 145 | |
| 146 | @s3_request |
nothing calls this directly
no outgoing calls
no test coverage detected