Skip to content

Commit 4ebcbc5

Browse files
committed
improved errors
1 parent 70582dd commit 4ebcbc5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

services/director-v2/src/simcore_service_director_v2/core/errors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Defines the different exceptions that may arise in the director
1+
"""Defines the different exceptions that may arise in the director
22
33
44
TODO: Exceptions should provide all info to create Error instances of the API model
@@ -88,13 +88,14 @@ def __init__(self, project_id: ProjectID, node_id: NodeID, **ctx: Any) -> None:
8888

8989
def get_errors(self) -> list[ErrorDict]:
9090
# default implementation
91+
9192
return [
9293
{
9394
"loc": (
9495
f"{self.project_id}",
9596
f"{self.node_id}",
9697
),
97-
"msg": f"{self.args[0]}",
98+
"msg": f"{self}",
9899
"type": self.code,
99100
},
100101
]

services/director-v2/src/simcore_service_director_v2/utils/dask.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
NodeportsException,
3535
S3InvalidPathError,
3636
StorageInvalidCall,
37+
UnboundPortError,
3738
)
3839
from simcore_sdk.node_ports_v2 import FileLinkType, Port, links, port_utils
3940
from simcore_sdk.node_ports_v2.links import ItemValue as _NPItemValue
@@ -147,6 +148,20 @@ async def parse_output_data(
147148
await (await ports.outputs)[port_key].set_value(value_to_transfer)
148149
except ValidationError as err:
149150
ports_errors.extend(_get_port_validation_errors(port_key, err))
151+
except UnboundPortError as err:
152+
ports_errors.extend(
153+
[
154+
{
155+
"loc": (
156+
project_id,
157+
node_id,
158+
port_key,
159+
),
160+
"msg": str(err),
161+
"type": "unbound_port",
162+
}
163+
]
164+
)
150165

151166
if ports_errors:
152167
raise PortsValidationError(

0 commit comments

Comments
 (0)