scim2-models 0.6.3__py3-none-any.whl → 0.6.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ from typing import Any
10
10
 
11
11
  from pydantic_core import PydanticCustomError
12
12
 
13
+ from .context import Context
14
+
13
15
  if TYPE_CHECKING:
14
16
  from .messages.error import Error
15
17
 
@@ -18,15 +20,25 @@ class SCIMException(Exception):
18
20
  """Base exception for SCIM protocol errors.
19
21
 
20
22
  Each subclass corresponds to a scimType defined in :rfc:`RFC 7644 Table 9 <7644#section-3.12>`.
23
+
24
+ :param detail: The error detail message.
25
+ :param scim_ctx: The SCIM context in which the exception occurred.
21
26
  """
22
27
 
23
28
  status: int = 400
24
29
  scim_type: str = ""
25
30
  _default_detail: str = "A SCIM error occurred"
26
31
 
27
- def __init__(self, *, detail: str | None = None, **context: Any):
32
+ def __init__(
33
+ self,
34
+ *,
35
+ detail: str | None = None,
36
+ scim_ctx: Context | None = None,
37
+ **context: Any,
38
+ ):
28
39
  self.context = context
29
40
  self._detail = detail
41
+ self.scim_ctx = scim_ctx
30
42
  super().__init__(detail or self._default_detail)
31
43
 
32
44
  @property
@@ -53,10 +65,13 @@ class SCIMException(Exception):
53
65
  )
54
66
 
55
67
  @classmethod
56
- def from_error(cls, error: "Error") -> "SCIMException":
68
+ def from_error(
69
+ cls, error: "Error", scim_ctx: Context | None = None
70
+ ) -> "SCIMException":
57
71
  """Create an exception from a SCIM Error object.
58
72
 
59
73
  :param error: The SCIM Error object to convert.
74
+ :param scim_ctx: The SCIM context in which the exception occurred.
60
75
  :return: The appropriate SCIMException subclass instance.
61
76
  """
62
77
  from .messages.error import Error
@@ -65,7 +80,7 @@ class SCIMException(Exception):
65
80
  raise TypeError(f"Expected Error, got {type(error).__name__}")
66
81
 
67
82
  exception_class = _SCIM_TYPE_TO_EXCEPTION.get(error.scim_type or "", cls)
68
- return exception_class(detail=error.detail)
83
+ return exception_class(detail=error.detail, scim_ctx=scim_ctx)
69
84
 
70
85
 
71
86
  class InvalidFilterException(SCIMException):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-models
3
- Version: 0.6.3
3
+ Version: 0.6.4
4
4
  Summary: SCIM2 models serialization and validation with pydantic
5
5
  Keywords: scim,scim2,provisioning,pydantic,rfc7643,rfc7644
6
6
  Author: Yaal Coop
@@ -4,7 +4,7 @@ scim2_models/attributes.py,sha256=v_bjJSdBmPlGh20W2Y57PIZnqvMTYHQyJuJLfQjGmwc,18
4
4
  scim2_models/base.py,sha256=dB0idU8apEwPwJpax1EWYX-omxcIy9Z4DMjNhrwTJAg,22407
5
5
  scim2_models/constants.py,sha256=9egq8JW0dFAqPng85CiHoH5T6pRtYL87-gC0C-IMGsk,573
6
6
  scim2_models/context.py,sha256=RjgMIvWPr8f41qbVL1sjaDnm9GRKyrCrgfC4npwwcMg,9149
7
- scim2_models/exceptions.py,sha256=_LbknoZrCrCaL7tKYrRF_G0vtru56OYrrqBARySAVXk,8684
7
+ scim2_models/exceptions.py,sha256=LidvSOcwHEW_oPwkrYTvDDXZnb7sTtEj7COWLyVaudI,9085
8
8
  scim2_models/messages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  scim2_models/messages/bulk.py,sha256=fWm9s88FHa66Aa0XeLcN7HurHp98JhlqM1rkEnIKZ8A,2429
10
10
  scim2_models/messages/error.py,sha256=gbHxf47ZIamnZAgD7cNAwHXxEZsf36PTdtcejesYIy0,12138
@@ -25,6 +25,6 @@ scim2_models/resources/service_provider_config.py,sha256=cmfPtLPOuwNrZl9hGpbrMsQ
25
25
  scim2_models/resources/user.py,sha256=uIUlEV4h1LsqWHLXvHVZWdx5H5n4X4kKknNzR15V72c,11332
26
26
  scim2_models/scim_object.py,sha256=suYhQ0iFQs1aKTlSerWZsi_sAVhFX_9N24U_DmZxCbw,5321
27
27
  scim2_models/utils.py,sha256=Lb7mlP3I_IfAlqi_8_m4G-_1Rn7oKRqbNdpoDLjXXr0,1978
28
- scim2_models-0.6.3.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
29
- scim2_models-0.6.3.dist-info/METADATA,sha256=DwqVdSFbzm9gp0MkXayievlAEArR_YTjHGWQ-7m2Ylw,17479
30
- scim2_models-0.6.3.dist-info/RECORD,,
28
+ scim2_models-0.6.4.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
29
+ scim2_models-0.6.4.dist-info/METADATA,sha256=vRMMHmtvg7AvC7ScDjkE92-QiUHKx0F8kXmgJNEY5NM,17479
30
+ scim2_models-0.6.4.dist-info/RECORD,,