Skip to content

Commit 114eb79

Browse files
authored
providers/scim: improve error message when object fails to sync (#16625)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
1 parent 4c2f307 commit 114eb79

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

authentik/lib/sync/outgoing/tasks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
TransientSyncException,
2121
)
2222
from authentik.lib.sync.outgoing.models import OutgoingSyncProvider
23+
from authentik.lib.utils.errors import exception_to_dict
2324
from authentik.lib.utils.reflection import class_to_path, path_to_class
2425
from authentik.tasks.models import Task
2526

@@ -164,16 +165,17 @@ def sync_objects(
164165
except BadRequestSyncException as exc:
165166
self.logger.warning("failed to sync object", exc=exc, obj=obj)
166167
task.warning(
167-
f"Failed to sync {obj._meta.verbose_name} {str(obj)} due to error: {str(exc)}",
168+
f"Failed to sync {str(obj)} due to error: {str(exc)}",
168169
arguments=exc.args[1:],
169170
obj=sanitize_item(obj),
171+
exception=exception_to_dict(exc),
170172
)
171173
except TransientSyncException as exc:
172174
self.logger.warning("failed to sync object", exc=exc, user=obj)
173175
task.warning(
174-
f"Failed to sync {obj._meta.verbose_name} {str(obj)} due to "
175-
f"transient error: {str(exc)}",
176+
f"Failed to sync {str(obj)} due to " f"transient error: {str(exc)}",
176177
obj=sanitize_item(obj),
178+
exception=exception_to_dict(exc),
177179
)
178180
except StopSync as exc:
179181
self.logger.warning("Stopping sync", exc=exc)

authentik/providers/scim/clients/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ def detail(self) -> str:
2727
except ValidationError:
2828
pass
2929
return self._message
30+
31+
def __str__(self):
32+
if self._response:
33+
return self._response.text
34+
return super().__str__()

0 commit comments

Comments
 (0)