99
1010
1111class Error (Message ):
12- """Representation of SCIM API errors.
13-
14- Here is the exhaustive list of pre-defined errors:
15-
16- .. py:data:: pydanti_scim2.InvalidFilterError
17-
18- The specified filter syntax
19- was invalid (does not comply
20- with :rfc:`Figure 1 of RFC7644 <7644#section-3.4.2.2>`), or the
21- specified attribute and filter
22- comparison combination is not
23- supported.
24-
25- .. py:data:: pydanti_scim2.TooManyError
26-
27- The specified filter yields
28- many more results than the
29- server is willing to calculate
30- or process. For example, a
31- filter such as ``(userName pr)``
32- by itself would return all
33- entries with a ``userName`` and
34- MAY not be acceptable to the
35- service provider.
36-
37- .. py:data:: pydanti_scim2.UniquenessError
38-
39- One or more of the attribute
40- values are already in use or
41- are reserved.
42-
43- .. py:data:: pydanti_scim2.MutabilityError
44-
45- The attempted modification is
46- not compatible with the target
47- attribute's mutability or
48- current state (e.g.,
49- modification of an "immutable"
50- attribute with an existing
51- value).
52-
53- .. py:data:: pydanti_scim2.InvalidSyntaxError
54-
55- The request body message
56- structure was invalid or did
57- not conform to the request
58- schema.
59-
60- .. py:data:: pydanti_scim2.InvalidPathError
61-
62- The "path" attribute was
63- invalid or malformed (see
64- :rfc:`Figure 7 of RFC7644 <7644#section-3.5.2>`).
65-
66- .. py:data:: pydanti_scim2.NoTargetError
67-
68- The specified "path" did not
69- yield an attribute or
70- attribute value that could be
71- operated on. This occurs when
72- the specified "path" value
73- contains a filter that yields
74- no match.
75-
76- .. py:data:: pydanti_scim2.InvalidValueError
77-
78- A required value was missing,
79- or the value specified was not
80- compatible with the operation
81- or attribute type (see :rfc:`Section
82- 2.2 of RFC7643 <7643#section-2.2>`), or resource
83- schema (see :rfc:`Section 4 of
84- RFC7643 <7643#section-4>`).
85-
86- .. py:data:: pydanti_scim2.InvalidVersionError
87-
88- The specified SCIM protocol
89- version is not supported (see
90- :rfc:`Section 3.13 of RFC7644 <7644#section-3.13>`).
91-
92- .. py:data:: pydanti_scim2.SensitiveError
93-
94- The specified request cannot
95- be completed, due to the
96- passing of sensitive (e.g.,
97- personal) information in a
98- request URI. For example,
99- personal information SHALL NOT
100- be transmitted over request
101- URIs. See :rfc:`Section 7.5.2 of RFC7644 <7644#section-7.5.2>`.
102- """
12+ """Representation of SCIM API errors."""
10313
10414 schemas : List [str ] = ["urn:ietf:params:scim:api:messages:2.0:Error" ]
10515
@@ -115,6 +25,16 @@ class Error(Message):
11525
11626 @classmethod
11727 def make_invalid_filter_error (cls ):
28+ """Pre-defined error intended to be raised when:
29+
30+ The specified filter syntax
31+ was invalid (does not comply
32+ with :rfc:`Figure 1 of RFC7644 <7644#section-3.4.2.2>`), or the
33+ specified attribute and filter
34+ comparison combination is not
35+ supported.
36+ """
37+
11838 return Error (
11939 status = 400 ,
12040 scim_type = "invalidFilter" ,
@@ -123,6 +43,20 @@ def make_invalid_filter_error(cls):
12343
12444 @classmethod
12545 def make_too_many_error (cls ):
46+ """Pre-defined error intended to be raised when:
47+
48+ The specified filter yields
49+ many more results than the
50+ server is willing to calculate
51+ or process. For example, a
52+ filter such as ``(userName pr)``
53+ by itself would return all
54+ entries with a ``userName`` and
55+ MAY not be acceptable to the
56+ service provider.
57+
58+ """
59+
12660 return Error (
12761 status = 400 ,
12862 scim_type = "tooMany" ,
@@ -131,6 +65,14 @@ def make_too_many_error(cls):
13165
13266 @classmethod
13367 def make_uniqueness_error (cls ):
68+ """Pre-defined error intended to be raised when:
69+
70+ One or more of the attribute
71+ values are already in use or
72+ are reserved.
73+
74+ """
75+
13476 return Error (
13577 status = 409 ,
13678 scim_type = "uniqueness" ,
@@ -139,6 +81,18 @@ def make_uniqueness_error(cls):
13981
14082 @classmethod
14183 def make_mutability_error (cls ):
84+ """Pre-defined error intended to be raised when:
85+
86+ The attempted modification is
87+ not compatible with the target
88+ attribute's mutability or
89+ current state (e.g.,
90+ modification of an "immutable"
91+ attribute with an existing
92+ value).
93+
94+ """
95+
14296 return Error (
14397 status = 400 ,
14498 scim_type = "mutability" ,
@@ -147,6 +101,15 @@ def make_mutability_error(cls):
147101
148102 @classmethod
149103 def make_invalid_syntax_error (cls ):
104+ """Pre-defined error intended to be raised when:
105+
106+ The request body message
107+ structure was invalid or did
108+ not conform to the request
109+ schema.
110+
111+ """
112+
150113 return Error (
151114 status = 400 ,
152115 scim_type = "invalidSyntax" ,
@@ -155,6 +118,14 @@ def make_invalid_syntax_error(cls):
155118
156119 @classmethod
157120 def make_invalid_path_error (cls ):
121+ """Pre-defined error intended to be raised when:
122+
123+ The "path" attribute was
124+ invalid or malformed (see
125+ :rfc:`Figure 7 of RFC7644 <7644#section-3.5.2>`).
126+
127+ """
128+
158129 return Error (
159130 status = 400 ,
160131 scim_type = "invalidPath" ,
@@ -163,6 +134,18 @@ def make_invalid_path_error(cls):
163134
164135 @classmethod
165136 def make_no_target_error (cls ):
137+ """Pre-defined error intended to be raised when:
138+
139+ The specified "path" did not
140+ yield an attribute or
141+ attribute value that could be
142+ operated on. This occurs when
143+ the specified "path" value
144+ contains a filter that yields
145+ no match.
146+
147+ """
148+
166149 return Error (
167150 status = 400 ,
168151 scim_type = "noTarget" ,
@@ -171,6 +154,18 @@ def make_no_target_error(cls):
171154
172155 @classmethod
173156 def make_invalid_value_error (cls ):
157+ """Pre-defined error intended to be raised when:
158+
159+ A required value was missing,
160+ or the value specified was not
161+ compatible with the operation
162+ or attribute type (see :rfc:`Section
163+ 2.2 of RFC7643 <7643#section-2.2>`), or resource
164+ schema (see :rfc:`Section 4 of
165+ RFC7643 <7643#section-4>`).
166+
167+ """
168+
174169 return Error (
175170 status = 400 ,
176171 scim_type = "invalidValue" ,
@@ -179,6 +174,14 @@ def make_invalid_value_error(cls):
179174
180175 @classmethod
181176 def make_invalid_version_error (cls ):
177+ """Pre-defined error intended to be raised when:
178+
179+ The specified SCIM protocol
180+ version is not supported (see
181+ :rfc:`Section 3.13 of RFC7644 <7644#section-3.13>`).
182+
183+ """
184+
182185 return Error (
183186 status = 400 ,
184187 scim_type = "invalidVers" ,
@@ -187,6 +190,19 @@ def make_invalid_version_error(cls):
187190
188191 @classmethod
189192 def make_sensitive_error (cls ):
193+ """Pre-defined error intended to be raised when:
194+
195+ The specified request cannot
196+ be completed, due to the
197+ passing of sensitive (e.g.,
198+ personal) information in a
199+ request URI. For example,
200+ personal information SHALL NOT
201+ be transmitted over request
202+ URIs. See :rfc:`Section 7.5.2 of RFC7644 <7644#section-7.5.2>`.
203+
204+ """
205+
190206 return Error (
191207 status = 400 ,
192208 scim_type = "sensitive" ,
0 commit comments