mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 08:27:06 +00:00
fix(policy): remove six dead error variants (#6631)
Backlog#1845 step 8 prerequisite. policy::error::Error carried six variants with zero construction and zero match sites anywhere in the workspace: ErrCredMalformed, CredNotInitialized, NoAccessKey, InvalidToken, InvalidAccessKey, InvalidExpiration. Their only reference was the grouped fallthrough arm in iam's From<policy::error::Error>, whose own dead same-name twins were already removed in backlog#1831 (#6030). Delete the variants and their display-message test rows; the iam mapping's grouped arm shrinks from eight variants to the two that are actually produced (InvalidServiceType from service_type parsing, JWTError via #[from]). This clears the way for folding the remaining 25-arm hand-written mapping (backlog#1845 step 8). Ref rustfs/backlog#1845
This commit is contained in:
@@ -60,12 +60,6 @@ pub enum Error {
|
||||
#[error("invalid service type: {0}")]
|
||||
InvalidServiceType(String),
|
||||
|
||||
#[error("malformed credential")]
|
||||
ErrCredMalformed,
|
||||
|
||||
#[error("CredNotInitialized")]
|
||||
CredNotInitialized,
|
||||
|
||||
#[error("invalid access key length")]
|
||||
InvalidAccessKeyLength,
|
||||
|
||||
@@ -81,21 +75,9 @@ pub enum Error {
|
||||
#[error("jwt err {0}")]
|
||||
JWTError(#[from] jsonwebtoken::errors::Error),
|
||||
|
||||
#[error("no access key")]
|
||||
NoAccessKey,
|
||||
|
||||
#[error("invalid token")]
|
||||
InvalidToken,
|
||||
|
||||
#[error("invalid access_key")]
|
||||
InvalidAccessKey,
|
||||
|
||||
#[error("action not allowed")]
|
||||
IAMActionNotAllowed,
|
||||
|
||||
#[error("invalid expiration")]
|
||||
InvalidExpiration,
|
||||
|
||||
#[error("no secret key with access key")]
|
||||
NoSecretKeyWithAccessKey,
|
||||
|
||||
@@ -343,17 +325,11 @@ mod tests {
|
||||
(Error::InvalidArgument, "invalid arguments specified"),
|
||||
(Error::IamSysNotInitialized, "not initialized"),
|
||||
(Error::InvalidServiceType("invalid".to_string()), "invalid service type: invalid"),
|
||||
(Error::ErrCredMalformed, "malformed credential"),
|
||||
(Error::CredNotInitialized, "CredNotInitialized"),
|
||||
(Error::InvalidAccessKeyLength, "invalid access key length"),
|
||||
(Error::InvalidSecretKeyLength, "invalid secret key length"),
|
||||
(Error::ContainsReservedChars, "access key contains reserved characters =,"),
|
||||
(Error::GroupNameContainsReservedChars, "group name contains reserved characters =,"),
|
||||
(Error::NoAccessKey, "no access key"),
|
||||
(Error::InvalidToken, "invalid token"),
|
||||
(Error::InvalidAccessKey, "invalid access_key"),
|
||||
(Error::IAMActionNotAllowed, "action not allowed"),
|
||||
(Error::InvalidExpiration, "invalid expiration"),
|
||||
(Error::NoSecretKeyWithAccessKey, "no secret key with access key"),
|
||||
(Error::NoAccessKeyWithSecretKey, "no access key with secret key"),
|
||||
(Error::PolicyTooLarge, "policy too large"),
|
||||
|
||||
Reference in New Issue
Block a user