Skip to content

Commit

Permalink
Merge pull request #14 from lsst-dm/tickets/DM-46688
Browse files Browse the repository at this point in the history
DM-46688: Return exception message on open fail.
  • Loading branch information
ktlim authored Oct 7, 2024
2 parents b13a27a + dba0b22 commit e31ecc2
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 e31ecc2

Please sign in to comment.