I think it can help the user figure out what's wrong if we give the
lengths of the field and the passed value in the error message.
Change-Id: I94fb7ca04724d5d7af701df88aaedc195b1736fd
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2088
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
def _set_value(self, values):
if len(self) != len(values):
- raise ValueError('expected length of value and array field to match')
+ raise ValueError(
+ 'expected length of value ({}) and array field ({}) to match'.format(
+ len(values), len(self)
+ )
+ )
for index, value in enumerate(values):
if value is not None: