Skip to content

Commit 00c96f9

Browse files
committed
Refactor exception handling and formatting in oauth2_auth.py
Simplified exception raising in _fetch_oidc_discovery by consolidating RuntimeError messages into single lines. Improved code readability by reformatting function calls to follow consistent indentation.
1 parent 16e71e2 commit 00c96f9

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

veadk/auth/middleware/oauth2_auth.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def _get_identity_client() -> "IdentityClient":
123123
"Ensure the veadk package is properly installed."
124124
) from e
125125

126+
126127
__all__ = [
127128
# Configuration classes
128129
"OAuth2Config",
@@ -221,13 +222,9 @@ def _fetch_oidc_discovery(
221222
f"OIDC discovery failed: HTTP {e.response.status_code} from {discovery_url}"
222223
) from e
223224
except httpx.RequestError as e:
224-
raise RuntimeError(
225-
f"OIDC discovery failed: {e} for {discovery_url}"
226-
) from e
225+
raise RuntimeError(f"OIDC discovery failed: {e} for {discovery_url}") from e
227226
except Exception as e:
228-
raise RuntimeError(
229-
f"OIDC discovery failed: {e}"
230-
) from e
227+
raise RuntimeError(f"OIDC discovery failed: {e}") from e
231228

232229

233230
class OAuth2Config(BaseModel):
@@ -383,7 +380,9 @@ def from_veidentity(
383380
identity_client = _get_identity_client()
384381

385382
# Step 1: Get or create user pool
386-
user_pool = identity_client.get_user_pool(name=user_pool_name, uid=user_pool_uid)
383+
user_pool = identity_client.get_user_pool(
384+
name=user_pool_name, uid=user_pool_uid
385+
)
387386
if user_pool:
388387
user_pool_id, user_pool_domain = user_pool
389388
logger.info(

0 commit comments

Comments
 (0)