Skip to content

Commit ef32e9f

Browse files
Surface connection test errors in the UI instead of failing silently (#71954)
Testing a connection only reported success or a failed test result; if the request itself errored the handler set the connection state to failed and showed nothing, leaving the user with a red icon and no explanation of what went wrong. Route those errors through the shared error toaster like every other mutation so the reason is shown.
1 parent e50cc0b commit ef32e9f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

airflow-core/src/airflow/ui/src/queries/useTestConnection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useTranslation } from "react-i18next";
2222
import { useConnectionServiceTestConnection } from "openapi/queries";
2323
import type { ConnectionTestResponse } from "openapi/requests/types.gen";
2424
import { toaster } from "src/components/ui";
25+
import { createErrorToaster } from "src/utils";
2526

2627
export const useTestConnection = (setConnected: Dispatch<SetStateAction<boolean | undefined>>) => {
2728
const { t: translate } = useTranslation("admin");
@@ -43,8 +44,9 @@ export const useTestConnection = (setConnected: Dispatch<SetStateAction<boolean
4344
}
4445
};
4546

46-
const onError = () => {
47+
const onError = (error: unknown) => {
4748
setConnected(false);
49+
createErrorToaster(error, { titleKey: "connections.testError.title" }, translate);
4850
};
4951

5052
return useConnectionServiceTestConnection({

0 commit comments

Comments
 (0)