This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 0dea2b8bab5 [v3-1-test] Add error handling for pause/unpause toggle 
permission errors (#61389) (#61533)
0dea2b8bab5 is described below

commit 0dea2b8bab5b88f8ab4a1e521ff874e81b232a58
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Feb 6 15:17:35 2026 +0100

    [v3-1-test] Add error handling for pause/unpause toggle permission errors 
(#61389) (#61533)
    
    * Add error handling for pause/unpause toggle permission errors
    
    - Add toaster notification when pause/unpause fails with 403
    - Display error message to user instead of silent failure
    - Follow existing error handling pattern from useTrigger
    
    Fixes #61363
    
    * ran perk-all-files
    (cherry picked from commit 2edb7be8a184632bc1cd40894fc7217072dbdecd)
    
    Co-authored-by: Dhananjay Gupta 
<[email protected]>
---
 airflow-core/src/airflow/ui/src/queries/useTogglePause.ts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/airflow-core/src/airflow/ui/src/queries/useTogglePause.ts 
b/airflow-core/src/airflow/ui/src/queries/useTogglePause.ts
index 198aec11532..c19b5124586 100644
--- a/airflow-core/src/airflow/ui/src/queries/useTogglePause.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useTogglePause.ts
@@ -17,6 +17,7 @@
  * under the License.
  */
 import { useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
 
 import {
   UseDagRunServiceGetDagRunsKeyFn,
@@ -26,9 +27,11 @@ import {
   useDagServiceGetDagsUiKey,
   UseTaskInstanceServiceGetTaskInstancesKeyFn,
 } from "openapi/queries";
+import { toaster } from "src/components/ui";
 
 export const useTogglePause = ({ dagId }: { dagId: string }) => {
   const queryClient = useQueryClient();
+  const { t: translate } = useTranslation("common");
 
   const onSuccess = async () => {
     const queryKeys = [
@@ -42,7 +45,16 @@ export const useTogglePause = ({ dagId }: { dagId: string }) 
=> {
     await Promise.all(queryKeys.map((key) => queryClient.invalidateQueries({ 
queryKey: key })));
   };
 
+  const onError = (error: Error) => {
+    toaster.create({
+      description: error.message,
+      title: translate("error.title"),
+      type: "error",
+    });
+  };
+
   return useDagServicePatchDag({
+    onError,
     onSuccess,
   });
 };

Reply via email to