Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Nov 9, 2023
1 parent 0a539cd commit be2bf10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/wavemem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,13 @@ impl SignalEncoder {
if len.get() == 1 {
let digit = if value.len() == 1 { value[0] } else { value[1] };
self.is_two_state &=
try_write_1_bit_4_state(time_idx_delta, digit, &mut self.data).unwrap();
try_write_1_bit_4_state(time_idx_delta, digit, &mut self.data)
.unwrap_or_else(|| {
panic!(
"Failed to parse four state value: {} for signal of size 1",
String::from_utf8_lossy(value)
)
});
} else {
let value_bits: &[u8] = match value[0] {
b'b' | b'B' => &value[1..],
Expand Down

0 comments on commit be2bf10

Please sign in to comment.