spawaveform: change assert to a ValueError