Skip to content

Commit

Permalink
Changed error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Fink authored and JulianSchmid committed Feb 26, 2024
1 parent 4ac7015 commit 2581843
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dlt_parse"
version = "0.9.1"
version = "0.9.2"
authors = ["Julian Schmid <[email protected]>"]
edition = "2021"
rust-version = "1.60"
Expand Down
16 changes: 5 additions & 11 deletions src/verbose/verbose_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl<'a> VerboseValue<'a> {
};

// determine the type

const TYPE_LEN_MASK_0: u8 = 0b0000_1111;
const BOOL_FLAG_0: u8 = 0b0001_0000;
const SIGNED_FLAG_0: u8 = 0b0010_0000;
Expand Down Expand Up @@ -619,12 +620,12 @@ impl<'a> VerboseValue<'a> {
} else {
None
};
let parse: Result<&str, str::Utf8Error> = match slicer.read_raw(len) {
let value = match slicer.read_raw(len) {
Ok(valid_parse) => {
if len > 0 {
core::str::from_utf8(&valid_parse[..valid_parse.len() - 1])
core::str::from_utf8(&valid_parse[..valid_parse.len() - 1])?
} else {
Ok("")
""
}
}
Err(_) => {
Expand All @@ -636,14 +637,7 @@ impl<'a> VerboseValue<'a> {
}
};

match parse {
Ok(value) => Ok((Str(StringValue { name, value }), slicer.rest())),
Err(_) => Err(UnexpectedEndOfSlice(UnexpectedEndOfSliceError {
layer: error::Layer::VerboseValue,
minimum_size: len,
actual_size: slicer.rest().len(),
})),
}
Ok((Str(StringValue { name, value }), slicer.rest()))
} else if 0 != type_info[1] & RAW_FLAG_1 {
// verify no conflicting information is present+
const CONTRADICTING_MASK_0: u8 = 0b1111_0000;
Expand Down

0 comments on commit 2581843

Please sign in to comment.