From 0f2c3dcb69f047cc1f0b92569b5e5a27eba8a874 Mon Sep 17 00:00:00 2001 From: Leo Kirchner Date: Mon, 28 Oct 2024 13:23:42 +0100 Subject: [PATCH] improves error message for contrib validated save --- changes/590.changed | 1 + nautobot_ssot/contrib/model.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changes/590.changed diff --git a/changes/590.changed b/changes/590.changed new file mode 100644 index 00000000..213bb79f --- /dev/null +++ b/changes/590.changed @@ -0,0 +1 @@ +Improved error message for validated save in contrib model. \ No newline at end of file diff --git a/nautobot_ssot/contrib/model.py b/nautobot_ssot/contrib/model.py index 12b6fcf6..3889607e 100644 --- a/nautobot_ssot/contrib/model.py +++ b/nautobot_ssot/contrib/model.py @@ -229,7 +229,9 @@ def _update_obj_with_parameters(cls, obj, parameters, adapter): try: obj.validated_save() except ValidationError as error: - raise ObjectCrudException(f"Validated save failed for Django object. Parameters: {parameters}") from error + raise ObjectCrudException( + f"Validated save failed for Django object:\n{error}\nParameters: {parameters}" + ) from error # Handle relationship association creation. This needs to be after object creation, because relationship # association objects rely on both sides already existing.