Skip to content

Commit ee490a4

Browse files
committed
Release v9.3.0
Signed-off-by: Xavier Lau <[email protected]>
1 parent 740e991 commit ee490a4

File tree

4 files changed

+42
-20
lines changed

4 files changed

+42
-20
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v9.3.0
2+
3+
- Use thiserror for error handling.
4+
15
### v9.2.2
26

37
- Fix case sensitivity in `ser_hexify_prefixed_upper`.

Cargo.lock

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ license = "Apache-2.0/GPL-3.0"
2121
name = "array-bytes"
2222
readme = "README.md"
2323
repository = "https://github.com/hack-ink/array-bytes"
24-
version = "9.2.2"
24+
version = "9.3.0"
2525

2626
[package.metadata.docs.rs]
2727
all-features = true
@@ -32,16 +32,20 @@ inherits = "dev"
3232

3333
[features]
3434
serde = [
35+
# crates.io
3536
"dep:serde",
3637
"serde_bytes",
3738
]
3839

3940
[dependencies]
41+
# crates.io
4042
serde = { version = "1.0", optional = true, default-features = false }
4143
serde_bytes = { version = "0.11", optional = true, default-features = false, features = ["alloc"] }
4244
smallvec = { version = "1.15" }
45+
thiserror = { version = "2.0", default-features = false }
4346

4447
[dev-dependencies]
48+
# crates.io
4549
const-hex = { version = "1.14" }
4650
criterion = { version = "0.6" }
4751
faster-hex = { version = "0.10" }

src/lib.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,17 @@ mod prelude {
140140
pub type Result<T, E = Error> = core::result::Result<T, E>;
141141

142142
#[allow(missing_docs)]
143-
#[derive(Debug, PartialEq, Eq)]
143+
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
144144
pub enum Error {
145-
/// The length must not be odd.
145+
#[error(transparent)]
146+
ParseIntError(#[from] core::num::ParseIntError),
147+
#[error(transparent)]
148+
Utf8Error(#[from] core::str::Utf8Error),
149+
150+
#[error("length must not be odd")]
146151
InvalidLength,
147-
/// Found the invalid character at `index`.
148-
InvalidCharacter {
149-
/// The invalid character.
150-
character: char,
151-
/// The invalid character's index.
152-
index: usize,
153-
},
154-
/// The data can not fit the array/slice length well.
155-
MismatchedLength {
156-
/// Expected length.
157-
expect: usize,
158-
},
159-
/// Failed to parse the hex number from hex string.
160-
Utf8Error(core::str::Utf8Error),
161-
/// Failed to parse the hex number from hex string.
162-
ParseIntError(core::num::ParseIntError),
152+
#[error("invalid character({character}) at index({index})")]
153+
InvalidCharacter { character: char, index: usize },
154+
#[error("mismatched length, expected {expect}")]
155+
MismatchedLength { expect: usize },
163156
}

0 commit comments

Comments
 (0)