Print duplicated value on error

This commit is contained in:
Rodrigo Arias 2023-02-16 15:59:20 +01:00 committed by Rodrigo Arias Mallo
parent e3339fef3b
commit 6b132f243e

View File

@ -71,7 +71,9 @@ check_duplicates(struct chan *chan, struct value *v)
return 0; return 0;
if (value_is_equal(&chan->last_value, v)) { if (value_is_equal(&chan->last_value, v)) {
err("%s: same value as last_value", chan->name); char buf[128];
err("%s: same value as last_value %s",
chan->name, value_str(chan->last_value, buf));
return -1; return -1;
} }
@ -92,13 +94,13 @@ chan_set(struct chan *chan, struct value value)
} }
if (check_duplicates(chan, &value) != 0) { if (check_duplicates(chan, &value) != 0) {
err("%s: cannot set a duplicated value", chan->name); err("%s: cannot set duplicated value", chan->name);
return -1; return -1;
} }
char buf[128]; char buf[128];
UNUSED(buf); UNUSED(buf);
dbg("chan_set %s: sets value to %s\n", dbg("%s: sets value to %s\n",
chan->name, value_str(value, buf)); chan->name, value_str(value, buf));
chan->data.value = value; chan->data.value = value;