a37a3122f9
- Extract tool_types validation to shared module (validate_compose_yaml, check_port_exposed, validate_required_variables) - Extract _get_user and _get_owned_project to auth/dependencies.py - Create useAsyncData hook and apply to 6 pages - Create extractErrorMessage utility - TypeScript and build pass
10 lines
428 B
TypeScript
10 lines
428 B
TypeScript
export const extractErrorMessage = (err: unknown): string => {
|
|
const axiosError = err as { response?: { data?: { detail?: string | Array<{ msg?: string }> } } };
|
|
const detail = axiosError?.response?.data?.detail;
|
|
if (typeof detail === "string") return detail;
|
|
if (Array.isArray(detail)) {
|
|
return detail.map((d) => typeof d === "string" ? d : d.msg || JSON.stringify(d)).join(", ");
|
|
}
|
|
return "Failed to save";
|
|
};
|