fix(server): surface upstream error
@@ -81,11 +81,20 @@ class RemoteRunnerClient(RunnerImpl):
client = self._get_client()
async with client.post(url, data=multipart) as resp:
body = await resp.read()
+ try:
meta_header = resp.headers[PAYLOAD_META_HEADER]
+ except KeyError:
+ raise ValueError(
+ f"Bento payload decode error: {PAYLOAD_META_HEADER} not exist. "
+ "An exception might have occurred in the upstream server."
+ f"[{resp.status}] {body.decode()}"
+ )
+
try:
payload = Payload(data=body, meta=json.loads(meta_header))
except JSONDecodeError:
raise ValueError(f"Bento payload decode error: {meta_header}")
+
return AutoContainer.payload_to_single(payload)
async def async_run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
