mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-09 19:53:54 +00:00
parent
d83f96293d
commit
15473e5137
2 changed files with 4 additions and 3 deletions
|
@ -110,7 +110,7 @@ pub(crate) async fn get_activity(
|
|||
.into();
|
||||
let activity = SentActivity::read_from_apub_id(&mut context.pool(), &activity_id)
|
||||
.await
|
||||
.with_lemmy_type(FederationError::CouldntFindActivity.into())?;
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)?;
|
||||
|
||||
let sensitive = activity.sensitive;
|
||||
if sensitive {
|
||||
|
|
|
@ -164,8 +164,6 @@ pub enum LemmyErrorType {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[non_exhaustive]
|
||||
pub enum FederationError {
|
||||
// TODO: merge into a single NotFound error
|
||||
CouldntFindActivity,
|
||||
InvalidCommunity,
|
||||
CannotCreatePostOrCommentInDeletedOrRemovedCommunity,
|
||||
CannotReceivePage,
|
||||
|
@ -246,6 +244,9 @@ cfg_if! {
|
|||
if self.error_type == LemmyErrorType::IncorrectLogin {
|
||||
return actix_web::http::StatusCode::UNAUTHORIZED;
|
||||
}
|
||||
if self.error_type == LemmyErrorType::NotFound {
|
||||
return actix_web::http::StatusCode::NOT_FOUND;
|
||||
}
|
||||
match self.inner.downcast_ref::<diesel::result::Error>() {
|
||||
Some(diesel::result::Error::NotFound) => actix_web::http::StatusCode::NOT_FOUND,
|
||||
_ => actix_web::http::StatusCode::BAD_REQUEST,
|
||||
|
|
Loading…
Reference in a new issue