Skip to content

Commit 4e23ce9

Browse files
committed
Display proper error for message not found
or not being downloadable Problem: When calling an program on a CRN, whose message the CRN couldn’t reach, it returned the error ``` 500: Unhandled error during initialisation ``` instead of a proper explaination error Solution: Catch that error. Catch also the other possible error when downloading This also now works when failing to download a runtime or volume
1 parent b860265 commit 4e23ce9

File tree

1 file changed

+7
-1
lines changed
  • src/aleph/vm/orchestrator

1 file changed

+7
-1
lines changed

src/aleph/vm/orchestrator/run.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Any
44

55
import msgpack
6-
from aiohttp import web
6+
from aiohttp import ClientResponseError, web
77
from aiohttp.web_exceptions import (
88
HTTPBadGateway,
99
HTTPBadRequest,
@@ -88,6 +88,12 @@ async def create_vm_execution_or_raise_http_error(vm_hash: ItemHash, pool: VmPoo
8888
logger.exception(error)
8989
pool.forget_vm(vm_hash=vm_hash)
9090
raise HTTPInternalServerError(reason="Host did not respond to ping") from error
91+
except ClientResponseError as error:
92+
logger.exception(error)
93+
if error.status == 404:
94+
raise HTTPInternalServerError(reason=f"Item hash {vm_hash} not found") from error
95+
else:
96+
raise HTTPInternalServerError(reason=f"Error downloading {vm_hash}") from error
9197
except Exception as error:
9298
logger.exception(error)
9399
pool.forget_vm(vm_hash=vm_hash)

0 commit comments

Comments
 (0)