mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Remove some anyhow dependencies
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -2765,7 +2765,6 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
"actix-web-httpauth",
|
||||||
"anyhow",
|
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -2792,7 +2791,6 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
"actix-web-httpauth",
|
||||||
"anyhow",
|
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -2838,7 +2836,6 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-session",
|
"actix-session",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
|
||||||
"askama",
|
"askama",
|
||||||
"askama_actix",
|
"askama_actix",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ hex = { version = "0.4.3", features = ["serde"] }
|
|||||||
mime_guess = "2.0.5"
|
mime_guess = "2.0.5"
|
||||||
itertools = "0.14"
|
itertools = "0.14"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
strum = { version = "0.26", features = ["strum_macros", "derive"] }
|
|
||||||
derive_more = { version = "1.0", features = [
|
derive_more = { version = "1.0", features = [
|
||||||
"from",
|
"from",
|
||||||
"try_into",
|
"try_into",
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ repository.workspace = true
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { workspace = true }
|
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ pub async fn route_post<C: CalendarStore, S: SubscriptionStore>(
|
|||||||
let sub_id = uuid::Uuid::new_v4().to_string();
|
let sub_id = uuid::Uuid::new_v4().to_string();
|
||||||
|
|
||||||
let expires = if let Some(expires) = request.expires {
|
let expires = if let Some(expires) = request.expires {
|
||||||
chrono::DateTime::parse_from_rfc2822(&expires)
|
chrono::DateTime::parse_from_rfc2822(&expires).map_err(Error::from)?
|
||||||
.map_err(|err| crate::Error::Other(err.into()))?
|
|
||||||
} else {
|
} else {
|
||||||
chrono::Utc::now().fixed_offset() + chrono::Duration::weeks(1)
|
chrono::Utc::now().fixed_offset() + chrono::Duration::weeks(1)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
StoreError(#[from] rustical_store::Error),
|
StoreError(#[from] rustical_store::Error),
|
||||||
|
|
||||||
|
#[error(transparent)]
|
||||||
|
ChronoParseError(#[from] chrono::ParseError),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
DavError(#[from] rustical_dav::Error),
|
DavError(#[from] rustical_dav::Error),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
XmlDecodeError(#[from] rustical_xml::XmlError),
|
XmlDecodeError(#[from] rustical_xml::XmlError),
|
||||||
|
|
||||||
#[error(transparent)]
|
|
||||||
Other(#[from] anyhow::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl actix_web::ResponseError for Error {
|
impl actix_web::ResponseError for Error {
|
||||||
@@ -33,11 +33,11 @@ impl actix_web::ResponseError for Error {
|
|||||||
rustical_store::Error::InvalidData(_) => StatusCode::BAD_REQUEST,
|
rustical_store::Error::InvalidData(_) => StatusCode::BAD_REQUEST,
|
||||||
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
},
|
},
|
||||||
|
Error::ChronoParseError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Error::DavError(err) => err.status_code(),
|
Error::DavError(err) => err.status_code(),
|
||||||
Error::Unauthorized => StatusCode::UNAUTHORIZED,
|
Error::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||||
Error::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
Error::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
||||||
Error::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
Error::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Error::Other(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
|
||||||
Error::NotFound => StatusCode::NOT_FOUND,
|
Error::NotFound => StatusCode::NOT_FOUND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ repository.workspace = true
|
|||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { workspace = true }
|
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ pub async fn route_post<A: AddressbookStore, S: SubscriptionStore>(
|
|||||||
let sub_id = uuid::Uuid::new_v4().to_string();
|
let sub_id = uuid::Uuid::new_v4().to_string();
|
||||||
|
|
||||||
let expires = if let Some(expires) = request.expires {
|
let expires = if let Some(expires) = request.expires {
|
||||||
chrono::DateTime::parse_from_rfc2822(&expires)
|
chrono::DateTime::parse_from_rfc2822(&expires).map_err(Error::from)?
|
||||||
.map_err(|err| crate::Error::Other(err.into()))?
|
|
||||||
} else {
|
} else {
|
||||||
chrono::Utc::now().fixed_offset() + chrono::Duration::weeks(1)
|
chrono::Utc::now().fixed_offset() + chrono::Duration::weeks(1)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
StoreError(#[from] rustical_store::Error),
|
StoreError(#[from] rustical_store::Error),
|
||||||
|
|
||||||
|
#[error(transparent)]
|
||||||
|
ChronoParseError(#[from] chrono::ParseError),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
DavError(#[from] rustical_dav::Error),
|
DavError(#[from] rustical_dav::Error),
|
||||||
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
XmlDecodeError(#[from] rustical_xml::XmlError),
|
XmlDecodeError(#[from] rustical_xml::XmlError),
|
||||||
|
|
||||||
#[error(transparent)]
|
|
||||||
Other(#[from] anyhow::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl actix_web::ResponseError for Error {
|
impl actix_web::ResponseError for Error {
|
||||||
@@ -33,11 +33,11 @@ impl actix_web::ResponseError for Error {
|
|||||||
rustical_store::Error::InvalidData(_) => StatusCode::BAD_REQUEST,
|
rustical_store::Error::InvalidData(_) => StatusCode::BAD_REQUEST,
|
||||||
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
},
|
},
|
||||||
|
Error::ChronoParseError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Error::DavError(err) => err.status_code(),
|
Error::DavError(err) => err.status_code(),
|
||||||
Error::Unauthorized => StatusCode::UNAUTHORIZED,
|
Error::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||||
Error::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
Error::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
||||||
Error::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
Error::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Error::Other(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
|
||||||
Error::NotFound => StatusCode::NOT_FOUND,
|
Error::NotFound => StatusCode::NOT_FOUND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ askama.workspace = true
|
|||||||
askama_actix = { workspace = true }
|
askama_actix = { workspace = true }
|
||||||
actix-session = { workspace = true }
|
actix-session = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::{CalDateTime, EventObject, JournalObject, TodoObject};
|
use super::{CalDateTime, EventObject, JournalObject, TodoObject};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use anyhow::Result;
|
|
||||||
use ical::parser::{ical::component::IcalTimeZone, Component};
|
use ical::parser::{ical::component::IcalTimeZone, Component};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|||||||
Reference in New Issue
Block a user