Skip to content

Commit

Permalink
More precise error msg on destination delete (#1148)
Browse files Browse the repository at this point in the history
* Show original exception message on destination delete
  • Loading branch information
podliashanyk authored Jan 24, 2025
1 parent 24d751c commit 7564dae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/1147.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show relevant error message on destination delete by passing the original exception message to the UI.
4 changes: 2 additions & 2 deletions src/argus/htmx/destination/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7564dae

Please sign in to comment.