Skip to content

Commit

Permalink
Return exception message on open fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Oct 6, 2024
1 parent b13a27a commit dba0b22
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/s3daemon/s3daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ async def handle_client(client, reader, writer):
start = time.time()
# ignore the alias
_, bucket, key = dest.split("/", maxsplit=2)
with open(filename, "rb") as f:
try:
try:
with open(filename, "rb") as f:
await client.put_object(Body=f, Bucket=bucket, Key=key)
writer.write(b"Success")
log.info("%f %f sec - %s", start, time.time() - start, filename)
except Exception as e:
writer.write(bytes(repr(e), "UTF-8"))
log.exception("%f %f sec - %s", start, time.time() - start, filename)
except Exception as e:
writer.write(bytes(repr(e), "UTF-8"))
log.exception("%f %f sec - %s", start, time.time() - start, filename)


async def go():
Expand Down

0 comments on commit dba0b22

Please sign in to comment.