Skip to content

Commit 60f9c5a

Browse files
committed
Try to give clearer error for p4p Value creation failure
1 parent 8f50204 commit 60f9c5a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/fastcs/transport/epics/pva/pvi_tree.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,18 @@ def make_p4p_value(self) -> Value:
139139
raw_value = self._make_p4p_raw_value()
140140
p4p_type = self._make_type_for_raw_value(raw_value)
141141

142-
return Value(
143-
p4p_type,
144-
{
145-
**p4p_alarm_states(),
146-
**p4p_timestamp_now(),
147-
**display,
148-
"value": raw_value,
149-
},
150-
)
142+
try:
143+
return Value(
144+
p4p_type,
145+
{
146+
**p4p_alarm_states(),
147+
**p4p_timestamp_now(),
148+
**display,
149+
"value": raw_value,
150+
},
151+
)
152+
except KeyError as e:
153+
raise ValueError(f"Failed to create p4p Value from {raw_value}") from e
151154

152155
def make_provider(
153156
self,

0 commit comments

Comments
 (0)