common: Add a error variant for unexpected header values
This commit is contained in:
parent
b7b9816314
commit
a12c38c532
@ -1,5 +1,10 @@
|
||||
# [unreleased]
|
||||
|
||||
Improvements:
|
||||
|
||||
- Add the `InvalidHeaderValue` variant to the `DeserializationError` struct, for
|
||||
cases where we receive a HTTP header with an unexpected value.
|
||||
|
||||
# 0.13.0
|
||||
|
||||
Bug fixes:
|
||||
|
@ -276,6 +276,20 @@ pub enum HeaderDeserializationError {
|
||||
/// The given required header is missing.
|
||||
#[error("missing header `{0}`")]
|
||||
MissingHeader(String),
|
||||
|
||||
/// A header was received with a unexpected value.
|
||||
#[error(
|
||||
"The {header} header was received with an unexpected value, \
|
||||
expected {expected}, received {unexpected}"
|
||||
)]
|
||||
InvalidHeaderValue {
|
||||
/// The name of the header containing the invalid value.
|
||||
header: String,
|
||||
/// The value the header should have been set to.
|
||||
expected: String,
|
||||
/// The value we instead received and rejected.
|
||||
unexpected: String,
|
||||
},
|
||||
}
|
||||
|
||||
/// An error that happens when Ruma cannot understand a Matrix version.
|
||||
|
Loading…
x
Reference in New Issue
Block a user