pierrejeambrun commented on code in PR #58016:
URL: https://github.com/apache/airflow/pull/58016#discussion_r2572204454


##########
airflow-core/src/airflow/ui/src/queries/useTrigger.ts:
##########
@@ -62,7 +63,22 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { 
dagId: string; onSucce
     }
   };
 
-  const onError = (_error: unknown) => {
+  const onError = (_error: Error) => {
+    // Check if error is a 403 (Forbidden) status
+    if (isHttpError(_error, 403)) {
+      toaster.create({
+        description: _error.message,
+        title: translate("triggerDag.toaster.error.forbidden.title", "Trigger 
DAG Permission Denied"),
+        type: "error",
+      });
+    } else {

Review Comment:
   You don't need this first case. 
   
   Just show the second case always that can handle any type of backend error, 
and display the error.
   
   Basically we need something similar to `useDeleteVariable`, a generic:
   ```
     const onError = (error: Error) => {
       toaster.create({
         description: error.message,
         title: translate("toaster.delete.error", {
           resourceName: translate("admin:variables.variable_one"),
         }),
         type: "error",
       });
     };
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to