-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
47 lines (29 loc) · 1.08 KB
/
exceptions.py
File metadata and controls
47 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""AuthGate exception hierarchy."""
from __future__ import annotations
class AuthGateError(Exception):
"""Base exception for all AuthGate errors."""
class OAuthError(AuthGateError):
"""OAuth 2.0 protocol error (RFC 6749 SS5.2)."""
def __init__(
self,
code: str,
description: str = "",
status_code: int = 0,
) -> None:
self.code = code
self.description = description
self.status_code = status_code
msg = f"oauth: {code}: {description}" if description else f"oauth: {code}"
super().__init__(msg)
class DiscoveryError(AuthGateError):
"""Error during OIDC discovery."""
class CredStoreError(AuthGateError):
"""Error in credential storage operations."""
class NotFoundError(CredStoreError):
"""No data found for the given client ID."""
class AuthFlowError(AuthGateError):
"""Error during an authentication flow."""
class TokenExpiredError(AuthFlowError):
"""The device code or token has expired."""
class AccessDeniedError(AuthFlowError):
"""Access was denied by the user or server."""