Skip to content

Commit

Permalink
sdk: prefer direct use of RefreshToken ctor instead of implicit `#[…
Browse files Browse the repository at this point in the history
…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().
  • Loading branch information
bnjbvr committed Jun 17, 2024
1 parent 7f64580 commit c33a7b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/matrix-sdk/src/client/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ where
// need to sign out.
}
};
return Err(refresh_error.into());
return Err(HttpError::RefreshToken(refresh_error));
}

_ => {
trace!("Token refresh: Token refresh failed.");
// This isn't necessarily correct, but matches the behaviour when
// implementing OIDC.
client.broadcast_unknown_token(soft_logout);
return Err(refresh_error.into());
return Err(HttpError::RefreshToken(refresh_error));
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub enum HttpError {

/// An error occurred while refreshing the access token.
#[error(transparent)]
RefreshToken(#[from] RefreshTokenError),
RefreshToken(RefreshTokenError),
}

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

0 comments on commit c33a7b7

Please sign in to comment.