You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a FromRequest for a type that uses a FromRequest of an Either under the hood is now impossible to the opaque error type of the EitherExtractFut.
Migrating the following code post 4.0.0 seems impossible:
pub enum Permission {... }
pub struct Permissions(HashSet<Permission>);
pub type AuthInfo = Either<Auth0AuthData, ApiKeyAuthData>;
impl FromRequest for Auth0AuthData { ... }
impl FromRequest for ApiKeyAuthData { ... }
impl FromRequest for Permissions {
type Error = PermissionError;
type Future = ResponseFuture<Result<Permissions, PermissionError>>;
fn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future {
let auth_info_fut = AuthInfo::extract(req);
let f = async move {
let auth_info = auth_info_fut.await.map_err(|e| match e {
EitherExtractError::Bytes(e) => PermissionError::Other(e.to_string()),
EitherExtractError::Extract(PermissionError::NoCredentials, r) => r,
EitherExtractError::Extract(l, _) => l,
)?;
match auth_info {
Either::Left(auth0) => auth0.permissions(&config_addr).await,
Either::Right(ApiKey { permissions, .. }) => Ok(Permissions(permissions)),
}
};
Box::pin(f)
}
}
Expected Behavior
EitherExtractError should be accessible
Current Behavior
It's opaque
Possible Solution
Revert the removal from the public api
Steps to Reproduce (for bugs)
Context
Your Environment
Rust Version (I.e, output of rustc -V):
Actix Web Version: 4.0.0-beta-10
The text was updated successfully, but these errors were encountered:
Creating a FromRequest for a type that uses a FromRequest of an Either under the hood is now impossible to the opaque error type of the EitherExtractFut.
Migrating the following code post 4.0.0 seems impossible:
Expected Behavior
EitherExtractError should be accessible
Current Behavior
It's opaque
Possible Solution
Revert the removal from the public api
Steps to Reproduce (for bugs)
Context
Your Environment
rustc -V
):The text was updated successfully, but these errors were encountered: