Add serde_html_form to Error; use serde_core for greater abstraction.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -418,6 +418,10 @@ version = "1.0"
|
|||||||
default-features = false
|
default-features = false
|
||||||
features = ["rc"]
|
features = ["rc"]
|
||||||
|
|
||||||
|
[workspace.dependencies.serde_core]
|
||||||
|
version = "1.0"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
[workspace.dependencies.serde_html_form]
|
[workspace.dependencies.serde_html_form]
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ reqwest.workspace = true
|
|||||||
ring.workspace = true
|
ring.workspace = true
|
||||||
ruma.workspace = true
|
ruma.workspace = true
|
||||||
sanitize-filename.workspace = true
|
sanitize-filename.workspace = true
|
||||||
|
serde_core.workspace = true
|
||||||
|
serde_html_form.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde_regex.workspace = true
|
serde_regex.workspace = true
|
||||||
serde_yaml.workspace = true
|
serde_yaml.workspace = true
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Figment(#[from] figment::error::Error),
|
Figment(#[from] figment::error::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
HtmlFormDe(#[from] serde_html_form::de::Error),
|
||||||
|
#[error(transparent)]
|
||||||
|
HtmlFormSer(#[from] serde_html_form::ser::Error),
|
||||||
|
#[error(transparent)]
|
||||||
Http(#[from] http::Error),
|
Http(#[from] http::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
HttpHeader(#[from] http::header::InvalidHeaderValue),
|
HttpHeader(#[from] http::header::InvalidHeaderValue),
|
||||||
@@ -91,6 +95,8 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
TypedHeader(#[from] axum_extra::typed_header::TypedHeaderRejection),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
UrlParse(#[from] url::ParseError),
|
||||||
|
#[error(transparent)]
|
||||||
Yaml(#[from] serde_yaml::Error),
|
Yaml(#[from] serde_yaml::Error),
|
||||||
|
|
||||||
// ruma/tuwunel
|
// ruma/tuwunel
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use serde::{de, ser};
|
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
impl de::Error for Error {
|
impl serde_core::de::Error for Error {
|
||||||
fn custom<T: Display + ToString>(msg: T) -> Self { Self::SerdeDe(msg.to_string().into()) }
|
fn custom<T: Display + ToString>(msg: T) -> Self { Self::SerdeDe(msg.to_string().into()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ser::Error for Error {
|
impl serde_core::ser::Error for Error {
|
||||||
fn custom<T: Display + ToString>(msg: T) -> Self { Self::SerdeSer(msg.to_string().into()) }
|
fn custom<T: Display + ToString>(msg: T) -> Self { Self::SerdeSer(msg.to_string().into()) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user