Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions hsds/chunk_sn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import base64
import math
import traceback
import numpy as np

from json import JSONDecodeError
Expand Down Expand Up @@ -1071,6 +1072,7 @@ async def GET_Value(request):

resp_json = {"status": 200} # will over-write if there's a problem
# write response
resp = None
try:
resp = StreamResponse()
if config.get("http_compression"):
Expand Down Expand Up @@ -1224,11 +1226,13 @@ async def GET_Value(request):
await resp.write_eof()
except Exception as e:
log.error(f"{type(e)} Exception during data write: {e}")
import traceback

tb = traceback.format_exc()
print("traceback:", tb)
raise HTTPInternalServerError()
log.error(f"traceback: {traceback.format_exc()}")
if resp is not None and resp.prepared:
# headers are already on the wire - raising here would inject a new
# status line into the body and corrupt the chunked stream
await resp.write_eof()
else:
raise HTTPInternalServerError()

return resp

Expand Down Expand Up @@ -1473,11 +1477,8 @@ async def POST_Value(request):
resp_body = resp_body.encode("utf-8")
await resp.write(resp_body)
except Exception as e:
log.error(f"{type(e)} Exception during response write")
import traceback

tb = traceback.format_exc()
print("traceback:", tb)
log.error(f"{type(e)} Exception during response write: {e}")
log.error(f"traceback: {traceback.format_exc()}")

# finalize response
await resp.write_eof()
Expand Down
Loading