Skip to content

Commit c33a7b7

Browse files
committed
sdk: prefer direct use of RefreshToken ctor instead of implicit #[from] conversions
This might be controversial, but I do strongly prefer explicit over implicit, in this case: it helps looking at the use cases, when using the LSP's goto_references().
1 parent 7f64580 commit c33a7b7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/matrix-sdk/src/client/futures.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ where
153153
// need to sign out.
154154
}
155155
};
156-
return Err(refresh_error.into());
156+
return Err(HttpError::RefreshToken(refresh_error));
157157
}
158158

159159
_ => {
160160
trace!("Token refresh: Token refresh failed.");
161161
// This isn't necessarily correct, but matches the behaviour when
162162
// implementing OIDC.
163163
client.broadcast_unknown_token(soft_logout);
164-
return Err(refresh_error.into());
164+
return Err(HttpError::RefreshToken(refresh_error));
165165
}
166166
}
167167
} else {

crates/matrix-sdk/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub enum HttpError {
102102

103103
/// An error occurred while refreshing the access token.
104104
#[error(transparent)]
105-
RefreshToken(#[from] RefreshTokenError),
105+
RefreshToken(RefreshTokenError),
106106
}
107107

108108
#[rustfmt::skip] // stop rustfmt breaking the `<code>` in docs across multiple lines

0 commit comments

Comments
 (0)