Skip to content

Commit

Permalink
refactor: InvalidTokenOnClosedMode -> InvalidTokenWithStrictBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois committed Jul 4, 2024
1 parent de8eb86 commit 1363734
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions server/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub enum EdgeError {
EdgeTokenParseError,
InvalidBackupFile(String, String),
InvalidServerUrl(String),
InvalidTokenOnClosedMode,
InvalidTokenWithStrictBehavior,
HealthCheckError(String),
JsonParseError(String),
NoFeaturesFile,
Expand Down Expand Up @@ -207,7 +207,7 @@ impl Display for EdgeError {
EdgeError::NotReady => {
write!(f, "Edge is not ready to serve requests")
}
EdgeError::InvalidTokenOnClosedMode => write!(f, "Edge is running in closed mode and the token is not subsumed by any registered tokens"),
EdgeError::InvalidTokenWithStrictBehavior => write!(f, "Edge is running with strict behavior and the token is not subsumed by any registered tokens"),
}
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ impl ResponseError for EdgeError {
EdgeError::ClientCacheError => StatusCode::INTERNAL_SERVER_ERROR,
EdgeError::FrontendExpectedToBeHydrated(_) => StatusCode::INTERNAL_SERVER_ERROR,
EdgeError::NotReady => StatusCode::SERVICE_UNAVAILABLE,
EdgeError::InvalidTokenOnClosedMode => StatusCode::FORBIDDEN,
EdgeError::InvalidTokenWithStrictBehavior => StatusCode::FORBIDDEN,
}
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/http/feature_refresher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl FeatureRefresher {
_ => {
if self.strict {
debug!("Strict behavior: Token is not subsumed by any registered tokens. Returning error");
Err(EdgeError::InvalidTokenOnClosedMode)
Err(EdgeError::InvalidTokenWithStrictBehavior)
} else {
debug!("Dynamic behavior: Had never seen this environment. Configuring fetcher");
self.register_and_hydrate_token(&token).await;
Expand Down

0 comments on commit 1363734

Please sign in to comment.