mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 10:32:19 +00:00
dav: remove anyhow dependency
This commit is contained in:
@@ -8,7 +8,6 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
actix-web = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
quick-xml = { workspace = true }
|
||||
|
||||
@@ -25,16 +25,12 @@ pub enum Error {
|
||||
|
||||
#[error(transparent)]
|
||||
XmlSerializationError(#[from] quick_xml::SeError),
|
||||
|
||||
#[error("Internal server error")]
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
impl actix_web::error::ResponseError for Error {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match self {
|
||||
Self::InternalError => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Self::Other(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Self::NotFound => StatusCode::NOT_FOUND,
|
||||
Self::BadRequest(_) => StatusCode::BAD_REQUEST,
|
||||
Self::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||
|
||||
@@ -18,7 +18,7 @@ use strum::VariantNames;
|
||||
pub trait Resource: Clone {
|
||||
type PropName: FromStr + VariantNames + Clone;
|
||||
type Prop: Serialize + for<'de> Deserialize<'de> + fmt::Debug + InvalidProperty;
|
||||
type Error: ResponseError + From<crate::Error> + From<anyhow::Error>;
|
||||
type Error: ResponseError + From<crate::Error>;
|
||||
|
||||
fn list_props() -> &'static [&'static str] {
|
||||
Self::PropName::VARIANTS
|
||||
@@ -139,7 +139,7 @@ pub trait ResourceService: Sized + 'static {
|
||||
type MemberType: Resource<Error = Self::Error>;
|
||||
type PathComponents: for<'de> Deserialize<'de> + Sized + Clone + 'static; // defines how the resource URI maps to parameters, i.e. /{principal}/{calendar} -> (String, String)
|
||||
type Resource: Resource<Error = Self::Error>;
|
||||
type Error: ResponseError + From<crate::Error> + From<anyhow::Error>;
|
||||
type Error: ResponseError + From<crate::Error>;
|
||||
|
||||
async fn new(
|
||||
req: &HttpRequest,
|
||||
|
||||
Reference in New Issue
Block a user