diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c6f73c51..ebbc91a33 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: exclude: &exclude_pattern '^changelog.d/' - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.2 + rev: v0.9.3 hooks: # Run the linter - id: ruff diff --git a/changelog.d/1147.fixed.md b/changelog.d/1147.fixed.md new file mode 100644 index 000000000..e489a6978 --- /dev/null +++ b/changelog.d/1147.fixed.md @@ -0,0 +1 @@ +Show relevant error message on destination delete by passing the original exception message to the UI. diff --git a/src/argus/htmx/destination/views.py b/src/argus/htmx/destination/views.py index fdd4cd489..df3c102c4 100644 --- a/src/argus/htmx/destination/views.py +++ b/src/argus/htmx/destination/views.py @@ -34,8 +34,8 @@ def delete_htmx(request, pk: int) -> HttpResponse: try: medium = api_safely_get_medium_object(destination.media.slug) medium.raise_if_not_deletable(destination) - except NotificationMedium.NotDeletableError: - error_msg = "That destination cannot be deleted." + except NotificationMedium.NotDeletableError as e: + error_msg = " ".join(e.args) else: destination.delete()