diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 5e36331c..ad6e40a2 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -1,6 +1,6 @@ use activitypub::{actor::Group, collection::OrderedCollection, object::Image, CustomObject}; use chrono::NaiveDateTime; -use diesel::{self, ExpressionMethods, QueryDsl, QueryResult, RunQueryDsl, SaveChangesDsl}; +use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use openssl::{ hash::MessageDigest, pkey::{PKey, Private}, @@ -195,10 +195,11 @@ impl Blog { } } - pub fn find_by_host(c: &PlumeRocket, host: Host) -> QueryResult { + pub fn find_by_host(c: &PlumeRocket, host: Host) -> Result { blogs::table .filter(blogs::custom_domain.eq(host)) .first::(&*c.conn) + .map_err(|_| Error::NotFound) } fn fetch_from_webfinger(c: &PlumeRocket, acct: &str) -> Result { diff --git a/src/routes/errors.rs b/src/routes/errors.rs index 23f38030..1320a068 100644 --- a/src/routes/errors.rs +++ b/src/routes/errors.rs @@ -14,12 +14,6 @@ impl From for ErrorPage { } } -impl From for ErrorPage { - fn from(err: diesel::result::Error) -> ErrorPage { - ErrorPage(plume_models::Error::Db(err)) - } -} - impl<'r> Responder<'r> for ErrorPage { fn respond_to(self, req: &Request) -> response::Result<'r> { let rockets = req.guard::().unwrap();