Skip to content

Commit cf01190

Browse files
committed
fix: some variables were missing from the SCIM exception classes
1 parent ddf9a44 commit cf01190

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

doc/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
[0.3.1] - 2024-11-29
5+
--------------------
6+
7+
Fixed
8+
^^^^^
9+
- Some variables were missing from the SCIM exception classes.
10+
411
[0.3.0] - 2024-11-29
512
--------------------
613

scim2_client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def check_response(
174174
scim_ctx: Optional[Context] = None,
175175
) -> Union[Error, None, dict, type[Resource]]:
176176
if expected_status_codes and status_code not in expected_status_codes:
177-
raise UnexpectedStatusCode()
177+
raise UnexpectedStatusCode(status_code)
178178

179179
# Interoperability considerations: The "application/scim+json" media
180180
# type is intended to identify JSON structure data that conforms to
@@ -207,7 +207,7 @@ def check_response(
207207
):
208208
error = Error.model_validate(response_payload)
209209
if raise_scim_errors:
210-
raise SCIMResponseErrorObject(source=error)
210+
raise SCIMResponseErrorObject(obj=error.detail, source=error)
211211
return error
212212

213213
if not expected_types:

scim2_client/errors.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,19 @@ class SCIMResponseErrorObject(SCIMResponseError):
6969
Those errors are only raised when the :code:`raise_scim_errors` parameter is :data:`True`.
7070
"""
7171

72-
def __init__(self, *args, **kwargs):
72+
def __init__(self, obj, *args, **kwargs):
7373
message = kwargs.pop(
74-
"message",
75-
f"The server returned a SCIM Error object: {kwargs['source'].detail}"
76-
if kwargs.get("source")
77-
else "The server returned a SCIM Error object",
74+
"message", f"The server returned a SCIM Error object: {obj}"
7875
)
7976
super().__init__(message, *args, **kwargs)
8077

8178

8279
class UnexpectedStatusCode(SCIMResponseError):
8380
"""Error raised when a server returned an unexpected status code for a given :class:`~scim2_models.Context`."""
8481

85-
def __init__(self, *args, **kwargs):
82+
def __init__(self, status_code: int, *args, **kwargs):
8683
message = kwargs.pop(
87-
"message",
88-
f"Unexpected response status code: {kwargs['source'].status_code}"
89-
if kwargs.get("source")
90-
else "Unexpected response status code",
84+
"message", f"Unexpected response status code: {status_code}"
9185
)
9286
super().__init__(message, *args, **kwargs)
9387

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)