Skip to content

Commit a958774

Browse files
FlorentinDMats-SX
andcommitted
Improve error message
Co-authored-by: Mats Rydberg <mats@neo4j.org>
1 parent 195530e commit a958774

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

graphdatascience/gds_session/aura_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ def from_json(cls, json: dict[str, Any]) -> TenantDetails:
103103
ds_type = type
104104
instance_types.add(configs["type"])
105105

106+
id = json["id"]
106107
if not ds_type:
107-
raise RuntimeError(f"Tenant cannot create DS instances. Available instances are `{instance_types}`.")
108+
raise RuntimeError(
109+
f"Tenant with id `{id}` cannot create DS instances. Available instances are `{instance_types}`."
110+
)
108111

109112
return cls(
110-
id=json["id"],
113+
id=id,
111114
ds_type=ds_type,
112115
regions_per_provider=regions_per_provider,
113116
)

graphdatascience/tests/unit/test_aura_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def test_parse_tenant_details() -> None:
383383

384384
def test_parse_non_ds_details() -> None:
385385
with pytest.raises(
386-
RuntimeError, match="Tenant cannot create DS instances. Available instances are `{'enterprise-db'}`."
386+
RuntimeError,
387+
match="Tenant with id `42` cannot create DS instances. Available instances are `{'enterprise-db'}`.",
387388
):
388389
TenantDetails.from_json(
389390
{

0 commit comments

Comments
 (0)