pierrejeambrun commented on code in PR #61560:
URL: https://github.com/apache/airflow/pull/61560#discussion_r2799659840
##########
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;
Review Comment:
Nit:
In other places we don't check the `instanceof ApiError` to keep things
consistent you can:
```
error?.status === 403 # if the compiler is happy
```
Or
```
(error as ExpandedApiError).status === 403
```
--
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]