From c73436091586b8a475ea7ad5c62d96d735565747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Sun, 8 Dec 2024 16:54:21 +0100 Subject: [PATCH] feat: error message improvement --- doc/changelog.rst | 7 +++++++ scim2_tester/utils.py | 4 +++- tests/test_network.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index d0a73ec..039aa0f 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,6 +1,13 @@ Changelog ========= +[0.1.11] - Unreleased +--------------------- + +Added +^^^^^ +- Slightly improved error messages. + [0.1.10] - 2024-12-02 --------------------- diff --git a/scim2_tester/utils.py b/scim2_tester/utils.py index 2e0f58c..3ac5991 100644 --- a/scim2_tester/utils.py +++ b/scim2_tester/utils.py @@ -77,8 +77,10 @@ def wrapped(conf: CheckConfig, *args, **kwargs): except SCIMClientError as exc: if conf.raise_exceptions: raise + + reason = f"{exc} {exc.__cause__}" if exc.__cause__ else str(exc) result = CheckResult( - conf, status=Status.ERROR, reason=str(exc), data=exc.source + conf, status=Status.ERROR, reason=reason, data=exc.source ) # decorate results diff --git a/tests/test_network.py b/tests/test_network.py index 3894e3c..1625332 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -22,7 +22,7 @@ def test_unreachable_host(): assert all(result.status == Status.ERROR for result in results) assert all( - result.reason == "Network error happened during request" for result in results + "Network error happened during request" in result.reason for result in results )