Skip to content

Commit 3b187f5

Browse files
MariaAgaadamruzicka
authored andcommitted
Fixes #38594 - add fallback to cancel error toast
1 parent 479c250 commit 3b187f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

webpack/JobInvocationDetail/TemplateInvocationComponents/TemplateActionButtons.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const actions = ({
4747
APIActions.post({
4848
url: `/foreman_tasks/tasks/${taskID}/cancel`,
4949
key: 'CANCEL_TASK',
50-
errorToast: ({ response }) => response.data.message,
50+
errorToast: ({ response }) =>
51+
response?.data?.message || __('Could not cancel the task'),
5152
successToast: () => __('Task for the host cancelled succesfully'),
5253
})
5354
);
@@ -70,7 +71,8 @@ const actions = ({
7071
APIActions.post({
7172
url: `/foreman_tasks/tasks/${taskID}/abort`,
7273
key: 'ABORT_TASK',
73-
errorToast: ({ response }) => response.data.message,
74+
errorToast: ({ response }) =>
75+
response?.data?.message || __('Could not abort the task'),
7476
successToast: () => __('task aborted succesfully'),
7577
})
7678
);

0 commit comments

Comments
 (0)