refactor(backend): replace unwraps with typed errors
This commit is contained in:
@@ -29,6 +29,7 @@ pub async fn mw_ctx_resolver(
|
||||
Some(token) => user_repository
|
||||
.get_session(&token)
|
||||
.await
|
||||
.and_then(|s| s.ok_or(LoftError::AuthFailSessionNotFound))
|
||||
.map(|s| Ctx::new(s.user_id)),
|
||||
None => Err(LoftError::AuthFailNoAuthTokenCookie),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user