Fixing LemmyError imports. (#5157)

This commit is contained in:
Dessalines 2024-11-04 04:44:58 -05:00 committed by GitHub
parent 02ba54c589
commit 18bf9843bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 32 additions and 27 deletions

View file

@ -5,10 +5,7 @@ use lemmy_api_common::{
request::fetch_link_metadata, request::fetch_link_metadata,
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{ use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
error::{LemmyErrorExt, LemmyResult},
LemmyErrorType,
};
use url::Url; use url::Url;
#[tracing::instrument(skip(context))] #[tracing::instrument(skip(context))]

View file

@ -31,7 +31,10 @@ use lemmy_db_schema::{
RegistrationMode, RegistrationMode,
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType, CACHE_DURATION_API}; use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
CACHE_DURATION_API,
};
use serial_test::serial; use serial_test::serial;
async fn create_test_site(context: &Data<LemmyContext>) -> LemmyResult<(Instance, LocalUserView)> { async fn create_test_site(context: &Data<LemmyContext>) -> LemmyResult<(Instance, LocalUserView)> {

View file

@ -26,7 +26,7 @@ pub extern crate lemmy_db_views_actor;
pub extern crate lemmy_db_views_moderator; pub extern crate lemmy_db_views_moderator;
pub extern crate lemmy_utils; pub extern crate lemmy_utils;
pub use lemmy_utils::LemmyErrorType; pub use lemmy_utils::error::LemmyErrorType;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{cmp::min, time::Duration}; use std::{cmp::min, time::Duration};

View file

@ -2,7 +2,7 @@ use chrono::{DateTime, TimeZone, Utc};
use lemmy_api_common::context::LemmyContext; use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::source::post::Post; use lemmy_db_schema::source::post::Post;
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
pub mod create; pub mod create;
pub mod delete; pub mod delete;

View file

@ -26,7 +26,7 @@ use crate::{
}; };
use activitypub_federation::{config::Data, traits::ActivityHandler}; use activitypub_federation::{config::Data, traits::ActivityHandler};
use lemmy_api_common::context::LemmyContext; use lemmy_api_common::context::LemmyContext;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;

View file

@ -86,7 +86,7 @@ mod tests {
traits::Crud, traits::Crud,
}; };
use lemmy_db_views::structs::LocalUserView; use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serial_test::serial; use serial_test::serial;
#[tokio::test] #[tokio::test]

View file

@ -15,7 +15,7 @@ use activitypub_federation::{
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use lemmy_api_common::context::LemmyContext; use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::ApubActor}; use lemmy_db_schema::{source::community::Community, traits::ApubActor};
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::Deserialize; use serde::Deserialize;
#[derive(Deserialize, Clone)] #[derive(Deserialize, Clone)]

View file

@ -7,7 +7,7 @@ use activitypub_federation::{config::Data, traits::Object};
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpResponse};
use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url}; use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url};
use lemmy_db_schema::{source::person::Person, traits::ApubActor}; use lemmy_db_schema::{source::person::Person, traits::ApubActor};
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::Deserialize; use serde::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]

View file

@ -24,7 +24,10 @@ use lemmy_db_schema::{
source::{community::Community, post::Post}, source::{community::Community, post::Post},
traits::Crud, traits::Crud,
}; };
use lemmy_utils::{error::LemmyResult, LemmyErrorType, MAX_COMMENT_DEPTH_LIMIT}; use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
MAX_COMMENT_DEPTH_LIMIT,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none; use serde_with::skip_serializing_none;
use url::Url; use url::Url;

View file

@ -13,7 +13,7 @@ use diesel::{
QueryDsl, QueryDsl,
}; };
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CaptchaAnswer { impl CaptchaAnswer {
pub async fn insert(pool: &mut DbPool<'_>, captcha: &CaptchaAnswerForm) -> Result<Self, Error> { pub async fn insert(pool: &mut DbPool<'_>, captcha: &CaptchaAnswerForm) -> Result<Self, Error> {

View file

@ -16,7 +16,7 @@ use diesel::{
QueryDsl, QueryDsl,
}; };
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityBlock { impl CommunityBlock {
pub async fn read( pub async fn read(

View file

@ -16,7 +16,7 @@ use diesel::{
QueryDsl, QueryDsl,
}; };
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl InstanceBlock { impl InstanceBlock {
pub async fn read( pub async fn read(

View file

@ -7,7 +7,7 @@ use crate::{
}; };
use diesel::{delete, dsl::exists, insert_into, result::Error, select}; use diesel::{delete, dsl::exists, insert_into, result::Error, select};
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl LoginToken { impl LoginToken {
pub async fn create(pool: &mut DbPool<'_>, form: LoginTokenCreateForm) -> Result<Self, Error> { pub async fn create(pool: &mut DbPool<'_>, form: LoginTokenCreateForm) -> Result<Self, Error> {

View file

@ -21,7 +21,7 @@ use diesel::{
QueryDsl, QueryDsl,
}; };
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
#[async_trait] #[async_trait]
impl Crud for Person { impl Crud for Person {

View file

@ -17,7 +17,7 @@ use diesel::{
QueryDsl, QueryDsl,
}; };
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl PersonBlock { impl PersonBlock {
pub async fn read( pub async fn read(

View file

@ -10,7 +10,7 @@ use crate::{
}; };
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, OptionalExtension, QueryDsl}; use diesel::{dsl::insert_into, result::Error, ExpressionMethods, OptionalExtension, QueryDsl};
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use url::Url; use url::Url;
#[async_trait] #[async_trait]

View file

@ -5,7 +5,7 @@ use lemmy_db_schema::{
schema::{local_site, local_site_rate_limit, site, site_aggregates}, schema::{local_site, local_site_rate_limit, site, site_aggregates},
utils::{get_conn, DbPool}, utils::{get_conn, DbPool},
}; };
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl SiteView { impl SiteView {
pub async fn read_local(pool: &mut DbPool<'_>) -> LemmyResult<Self> { pub async fn read_local(pool: &mut DbPool<'_>) -> LemmyResult<Self> {

View file

@ -8,7 +8,7 @@ use lemmy_db_schema::{
source::local_user::LocalUser, source::local_user::LocalUser,
utils::{get_conn, DbPool}, utils::{get_conn, DbPool},
}; };
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityModeratorView { impl CommunityModeratorView {
pub async fn check_is_community_moderator( pub async fn check_is_community_moderator(

View file

@ -11,7 +11,7 @@ use lemmy_db_schema::{
schema::community_person_ban, schema::community_person_ban,
utils::{get_conn, DbPool}, utils::{get_conn, DbPool},
}; };
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityPersonBanView { impl CommunityPersonBanView {
pub async fn check( pub async fn check(

View file

@ -35,7 +35,7 @@ use lemmy_db_schema::{
ListingType, ListingType,
PostSortType, PostSortType,
}; };
use lemmy_utils::{error::LemmyResult, LemmyErrorType}; use lemmy_utils::error::{LemmyErrorType, LemmyResult};
fn queries<'a>() -> Queries< fn queries<'a>() -> Queries<
impl ReadFn<'a, CommunityView, (CommunityId, Option<&'a LocalUser>, bool)>, impl ReadFn<'a, CommunityView, (CommunityId, Option<&'a LocalUser>, bool)>,

View file

@ -13,7 +13,6 @@ cfg_if! {
} }
pub mod error; pub mod error;
pub use error::LemmyErrorType;
use std::time::Duration; use std::time::Duration;
pub type ConnectionId = usize; pub type ConnectionId = usize;

View file

@ -1,4 +1,4 @@
use crate::{error::LemmyResult, LemmyErrorType}; use crate::error::{LemmyErrorType, LemmyResult};
use markdown_it::MarkdownIt; use markdown_it::MarkdownIt;
use regex::RegexSet; use regex::RegexSet;
use std::sync::LazyLock; use std::sync::LazyLock;

View file

@ -1,4 +1,4 @@
use lemmy_utils::LemmyErrorType; use lemmy_utils::error::LemmyErrorType;
use std::{env::current_dir, process::Command}; use std::{env::current_dir, process::Command};
use strum::IntoEnumIterator; use strum::IntoEnumIterator;

View file

@ -609,7 +609,10 @@ mod tests {
use crate::scheduled_tasks::build_update_instance_form; use crate::scheduled_tasks::build_update_instance_form;
use lemmy_api_common::request::client_builder; use lemmy_api_common::request::client_builder;
use lemmy_utils::{error::LemmyResult, settings::structs::Settings, LemmyErrorType}; use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
settings::structs::Settings,
};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use reqwest_middleware::ClientBuilder; use reqwest_middleware::ClientBuilder;
use serial_test::serial; use serial_test::serial;