diff --git a/src/cookies.rs b/src/cookies.rs index aed56c9..536a7f4 100644 --- a/src/cookies.rs +++ b/src/cookies.rs @@ -34,7 +34,7 @@ impl<'r> FromRequest<'r> for Session { if let Some(session) = get_session(cookies) { Outcome::Success(session) } else { - Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError)) + Outcome::Error((Status::Unauthorized, Error::UnauthorizedError)) } } } diff --git a/src/user/auth.rs b/src/user/auth.rs index d626cbf..84541ac 100644 --- a/src/user/auth.rs +++ b/src/user/auth.rs @@ -64,7 +64,7 @@ impl<'r> FromRequest<'r> for Auth<'r> { let users: &State = if let Outcome::Success(users) = req.guard().await { users } else { - return Outcome::Failure((Status::InternalServerError, Error::UnmanagedStateError)); + return Outcome::Error((Status::InternalServerError, Error::UnmanagedStateError)); }; Outcome::Success(Auth { diff --git a/src/user/user_impl.rs b/src/user/user_impl.rs index e5ebe05..319baf9 100644 --- a/src/user/user_impl.rs +++ b/src/user/user_impl.rs @@ -113,13 +113,13 @@ impl<'r> FromRequest<'r> for User { let guard = request.guard().await; let auth: Auth = match guard { Success(auth) => auth, - Failure(x) => return Failure(x), + Error(x) => return Error(x), Forward(x) => return Forward(x), }; if let Some(user) = auth.get_user().await { Outcome::Success(user) } else { - Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError)) + Outcome::Error((Status::Unauthorized, Self::Error::UnauthorizedError)) } } } @@ -132,7 +132,7 @@ impl<'r> FromRequest<'r> for AdminUser { let guard = request.guard().await; let auth: Auth = match guard { Success(auth) => auth, - Failure(x) => return Failure(x), + Error(x) => return Error(x), Forward(x) => return Forward(x), }; if let Some(user) = auth.get_user().await { @@ -140,7 +140,7 @@ impl<'r> FromRequest<'r> for AdminUser { return Outcome::Success(AdminUser(user)); } } - Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError)) + Outcome::Error((Status::Unauthorized, Self::Error::UnauthorizedError)) } }