show detail from api when workflow run fails to start (#1826)

This commit is contained in:
Shuchang Zheng
2025-02-24 10:08:36 -08:00
committed by GitHub
parent d1b26d7068
commit 6086613139

View File

@@ -24,6 +24,7 @@ import { useNavigate, useParams } from "react-router-dom";
import { z } from "zod";
import { WorkflowParameter } from "./types/workflowTypes";
import { WorkflowParameterInput } from "./WorkflowParameterInput";
import { AxiosError } from "axios";
type Props = {
workflowParameters: Array<WorkflowParameter>;
@@ -139,11 +140,12 @@ function RunWorkflowForm({
`/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`,
);
},
onError: (error) => {
onError: (error: AxiosError) => {
const detail = (error.response?.data as { detail?: string })?.detail;
toast({
variant: "destructive",
title: "Failed to start workflow run",
description: error.message,
description: detail ?? error.message,
});
},
});