-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.rs
More file actions
26 lines (24 loc) · 775 Bytes
/
Copy patherror.rs
File metadata and controls
26 lines (24 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Public validation errors.
use std::ops::Range;
/// A byte-range or payload validation error.
#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
pub enum RangeError {
/// A range had its end before its start.
#[error("reversed byte range {start}..{end}")]
ReversedRange {
/// Inclusive start offset.
start: usize,
/// Exclusive end offset.
end: usize,
},
/// A payload length did not equal the range length.
#[error("range {range:?} requires {expected} bytes, received {actual}")]
PayloadLengthMismatch {
/// Range associated with the payload.
range: Range<usize>,
/// Required byte length.
expected: usize,
/// Actual byte length.
actual: usize,
},
}