Skip to content

Commit

Permalink
add error type
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Nov 11, 2023
1 parent 8e227e8 commit 9e37743
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/kitsune-webfinger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ kitsune-http-client = { path = "../kitsune-http-client" }
kitsune-type = { path = "../kitsune-type" }
kitsune-util = { path = "../kitsune-util" }
serde = { version = "1.0.192", features = ["derive"] }
thiserror = "1.0.50"
tracing = "0.1.40"

[dev-dependencies]
Expand Down
12 changes: 12 additions & 0 deletions crates/kitsune-webfinger/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use thiserror::Error;

pub type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Error)]
pub enum Error {
#[error(transparent)]
Cache(#[from] kitsune_cache::Error),

#[error(transparent)]
HttpClient(#[from] kitsune_http_client::Error),
}
5 changes: 3 additions & 2 deletions crates/kitsune-webfinger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ extern crate tracing;

use crate::{consts::USER_AGENT, error::Result};
use autometrics::autometrics;
use core::ptr;
use futures_util::future::{FutureExt, OptionFuture};
use http::{HeaderValue, StatusCode};
use kitsune_cache::{ArcCache, CacheBackend, RedisCache};
use kitsune_http_client::Client;
use kitsune_type::webfinger::Resource;
use kitsune_util::try_join;
use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration};
use std::{ptr, sync::Arc, time::Duration};

pub mod error;

const CACHE_DURATION: Duration = Duration::from_secs(10 * 60); // 10 minutes

Expand Down

0 comments on commit 9e37743

Please sign in to comment.