Push async submit, Chinese 422 field labels, hide server CSV export.
Nexus CI/CD / test (push) Waiting to run
Nexus CI/CD / deploy (push) Blocked by required conditions
Nexus Pre-commit Checks / quick-check (push) Waiting to run

Return sync/files immediately with background runner; show loc_zh in validation errors; remove servers toolbar CSV export button.
This commit is contained in:
Nexus Agent
2026-06-08 23:28:26 +08:00
parent abeab9d3e4
commit 091fb97291
15 changed files with 341 additions and 67 deletions
+7 -14
View File
@@ -1,22 +1,15 @@
import { ApiError } from '@/api'
import { formatValidationDetail } from '@/utils/validationErrorFormat'
/** Turn FastAPI error bodies into a human-readable string. */
export function formatApiError(e: unknown, fallback: string): string {
let msg = fallback
if (e instanceof ApiError) {
const d = (e as ApiError & { detail?: unknown }).detail ?? e.message
if (typeof d === 'string') msg = d
else if (Array.isArray(d)) {
msg = d.map((x: { msg?: string; loc?: unknown[] }) => {
const part = x?.msg || JSON.stringify(x)
const loc = Array.isArray(x.loc) ? x.loc.filter((p) => p !== 'body').join('.') : ''
return loc ? `${loc}: ${part}` : part
}).join('; ')
} else if (d && typeof d === 'object') msg = JSON.stringify(d)
else msg = e.message || fallback
} else if (e instanceof Error) {
msg = e.message || fallback
return formatValidationDetail(d, e.message || fallback)
}
msg = msg.trim()
return msg || fallback
if (e instanceof Error) {
const msg = e.message.trim()
return msg || fallback
}
return fallback
}