Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 12 additions & 30 deletions src/dispatch/signal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,9 @@ def create_engagement(
db_session=db_session, creator=current_user, signal_engagement_in=signal_engagement_in
)
except IntegrityError:
raise ValidationError(
[
ErrorWrapper(
ExistsError(msg="A signal engagement with this name already exists."),
loc="name",
)
],
model=SignalEngagementRead,
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "A signal engagement with this name already exists."}],
) from None


Expand Down Expand Up @@ -195,14 +190,9 @@ def update_engagement(
signal_engagement_in=signal_engagement_in,
)
except IntegrityError:
raise ValidationError(
[
ErrorWrapper(
ExistsError(msg="A signal engagement with this name already exists."),
loc="name",
)
],
model=SignalEngagementUpdate,
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "A signal engagement with this name already exists."}],
) from None

return signal_engagement
Expand All @@ -220,13 +210,9 @@ def create_filter(
db_session=db_session, creator=current_user, signal_filter_in=signal_filter_in
)
except IntegrityError:
raise ValidationError(
[
ErrorWrapper(
ExistsError(msg="A signal filter with this name already exists."), loc="name"
)
],
model=SignalFilterRead,
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "A signal filter with this name already exists."}],
) from None


Expand All @@ -253,13 +239,9 @@ def update_filter(
db_session=db_session, signal_filter=signal_filter, signal_filter_in=signal_filter_in
)
except IntegrityError:
raise ValidationError(
[
ErrorWrapper(
ExistsError(msg="A signal filter with this name already exists."), loc="name"
)
],
model=SignalFilterUpdate,
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail=[{"msg": "A signal filter with this name already exists."}],
) from None

return signal_filter
Expand Down
19 changes: 16 additions & 3 deletions src/dispatch/static/dispatch/src/signal/engagement/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ const actions = {
commit("RESET_SELECTED")
return resp.data
})
.catch((error) => {
console.log(error)
.catch((err) => {
let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
commit(
"notification_backend/addBeNotification",
{ text: `Error trying to save: ${errorText}`, type: "exception" },
{ root: true }
)
commit("RESET_SELECTED")
commit("SET_SELECTED_LOADING", false)
})
} else {
Expand All @@ -55,7 +61,14 @@ const actions = {
)
commit("SET_SELECTED_LOADING", false)
})
.catch(() => {
.catch((err) => {
let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
commit(
"notification_backend/addBeNotification",
{ text: `Error trying to save: ${errorText}`, type: "exception" },
{ root: true }
)
commit("RESET_SELECTED")
commit("SET_SELECTED_LOADING", false)
})
}
Expand Down
18 changes: 16 additions & 2 deletions src/dispatch/static/dispatch/src/signal/filter/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ const actions = {
commit("SET_DIALOG_CREATE_EDIT", false)
return resp.data
})
.catch(() => {
.catch((err) => {
let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
commit(
"notification_backend/addBeNotification",
{ text: `Error trying to save: ${errorText}`, type: "exception" },
{ root: true }
)
commit("RESET_SELECTED")
commit("SET_SELECTED_LOADING", false)
})
} else {
Expand All @@ -78,7 +85,14 @@ const actions = {
)
commit("SET_SELECTED_LOADING", false)
})
.catch(() => {
.catch((err) => {
let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
commit(
"notification_backend/addBeNotification",
{ text: `Error trying to save: ${errorText}`, type: "exception" },
{ root: true }
)
commit("RESET_SELECTED")
commit("SET_SELECTED_LOADING", false)
})
}
Expand Down
Loading