Skip to content

Commit

Permalink
Display proper error for message not found
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olethanh committed Jan 16, 2025
1 parent b860265 commit 4e23ce9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/aleph/vm/orchestrator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any

import msgpack
from aiohttp import web
from aiohttp import ClientResponseError, web
from aiohttp.web_exceptions import (
HTTPBadGateway,
HTTPBadRequest,
Expand Down Expand Up @@ -88,6 +88,12 @@ async def create_vm_execution_or_raise_http_error(vm_hash: ItemHash, pool: VmPoo
logger.exception(error)
pool.forget_vm(vm_hash=vm_hash)
raise HTTPInternalServerError(reason="Host did not respond to ping") from error
except ClientResponseError as error:
logger.exception(error)
if error.status == 404:
raise HTTPInternalServerError(reason=f"Item hash {vm_hash} not found") from error
else:
raise HTTPInternalServerError(reason=f"Error downloading {vm_hash}") from error
except Exception as error:
logger.exception(error)
pool.forget_vm(vm_hash=vm_hash)
Expand Down

0 comments on commit 4e23ce9

Please sign in to comment.