liamkernan commented on code in PR #61560:
URL: https://github.com/apache/airflow/pull/61560#discussion_r2879147785


##########
airflow-core/src/airflow/ui/src/queries/useDagParsing.ts:
##########
@@ -24,16 +24,23 @@ import {
   UseDagServiceGetDagDetailsKeyFn,
   UseDagSourceServiceGetDagSourceKeyFn,
 } from "openapi/queries";
+import { ApiError } from "openapi/requests";
 import { toaster } from "src/components/ui";
 
 export const useDagParsing = ({ dagId }: { readonly dagId: string }) => {
   const queryClient = useQueryClient();
   const { t: translate } = useTranslation("dag");
 
-  const onError = () => {
+  const onError = (error: unknown) => {
+    const isForbidden = error instanceof ApiError && error.status === 403;
+
     toaster.create({
-      description: translate("parse.toaster.error.description"),
-      title: translate("parse.toaster.error.title"),
+      description: isForbidden
+        ? translate("parse.toaster.forbidden.description")
+        : translate("parse.toaster.error.description"),
+      title: isForbidden
+        ? translate("parse.toaster.forbidden.title")
+        : translate("parse.toaster.error.title"),
       type: "error",

Review Comment:
   I added a shared error-toast helper at src/queries/createErrorToaster.ts and 
switched useDagParsing to use it.
   The helper centralizes 403 -> common access denied toast, with fallback 
title/description for non-403 errors. This should make follow-up centralization 
in #61588 straightforward.



-- 
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