Skip to content

Commit e6bc3c3

Browse files
committed
Fix error message.
1 parent 206f7a4 commit e6bc3c3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/graphnet/training/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,11 @@ def add_custom_labels(
351351
for key, fn in custom_label_functions.items():
352352
try:
353353
label = fn(data)
354-
except KeyError:
355-
raise KeyError(f"Key {key} not found in data.")
354+
except KeyError as e:
355+
raise KeyError(
356+
f"Label '{key}' could not be computed because "
357+
f"its required data field {e} is missing."
358+
) from e
356359
if repeat_labels_by is not None:
357360
label = label.repeat(data.x.shape[repeat_labels_by], 1)
358361
data[key] = label

0 commit comments

Comments
 (0)