authentik.providers.scim.clients.exceptions

SCIM Client exceptions

 1"""SCIM Client exceptions"""
 2
 3from pydantic import ValidationError
 4from requests import Response
 5
 6from authentik.lib.sync.outgoing.exceptions import TransientSyncException
 7from authentik.providers.scim.clients.schema import SCIMError
 8
 9
10class SCIMRequestException(TransientSyncException):
11    """Exception raised when an SCIM request fails"""
12
13    _response: Response | None
14    _message: str | None
15
16    def __init__(self, response: Response | None = None, message: str | None = None) -> None:
17        super().__init__(response)
18        self._response = response
19        self._message = message
20
21    def detail(self) -> str:
22        """Get human readable details of this error"""
23        if not self._response:
24            return self._message
25        try:
26            error = SCIMError.model_validate_json(self._response.text)
27            return error.detail
28        except ValidationError:
29            pass
30        return self._message
31
32    def __str__(self):
33        if self._response:
34            return self._response.text
35        return super().__str__()
class SCIMRequestException(authentik.lib.sync.outgoing.exceptions.TransientSyncException):
11class SCIMRequestException(TransientSyncException):
12    """Exception raised when an SCIM request fails"""
13
14    _response: Response | None
15    _message: str | None
16
17    def __init__(self, response: Response | None = None, message: str | None = None) -> None:
18        super().__init__(response)
19        self._response = response
20        self._message = message
21
22    def detail(self) -> str:
23        """Get human readable details of this error"""
24        if not self._response:
25            return self._message
26        try:
27            error = SCIMError.model_validate_json(self._response.text)
28            return error.detail
29        except ValidationError:
30            pass
31        return self._message
32
33    def __str__(self):
34        if self._response:
35            return self._response.text
36        return super().__str__()

Exception raised when an SCIM request fails

SCIMRequestException( response: requests.models.Response | None = None, message: str | None = None)
17    def __init__(self, response: Response | None = None, message: str | None = None) -> None:
18        super().__init__(response)
19        self._response = response
20        self._message = message
def detail(self) -> str:
22    def detail(self) -> str:
23        """Get human readable details of this error"""
24        if not self._response:
25            return self._message
26        try:
27            error = SCIMError.model_validate_json(self._response.text)
28            return error.detail
29        except ValidationError:
30            pass
31        return self._message

Get human readable details of this error