mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
## What changed - Return structured validation issues with stable codes, complete field paths, constraints, and minimal correction examples. - Preserve validation details through the Builder API, CLI, MCP, local project sessions, and tRPC errors. - Explain invalid expressions, JSX fragments, page selectors, component inputs, asset updates, and project settings in terms an agent can act on. - Remove stack frames and credentials from parser details before exposing them. - Keep concise human-readable errors while making the complete structured issues available to agents. ## Why Agents previously received vague errors without enough information to repair a request. They could repeat the same invalid call or require manual intervention. ## User impact CLI and MCP agents can now identify the exact invalid field, understand the constraint, see a valid example, and retry with a corrected request. ## Validation - Focused runtime, MCP, CLI, API, and tRPC validation tests. - Structured error propagation tests across local and server execution. - Typechecks and generated contract verification.
20 lines
505 B
TypeScript
20 lines
505 B
TypeScript
const publicApiRemoteErrorCodes = [
|
|
"BAD_REQUEST",
|
|
"CONFLICT",
|
|
"FORBIDDEN",
|
|
"INTERNAL_SERVER_ERROR",
|
|
"INVALID_INPUT",
|
|
"NOT_FOUND",
|
|
"PROJECT_NOT_PUBLISHED",
|
|
"UNAUTHORIZED",
|
|
] as const;
|
|
|
|
export type PublicApiRemoteErrorCode =
|
|
(typeof publicApiRemoteErrorCodes)[number];
|
|
|
|
const publicApiRemoteErrorCodeSet = new Set<string>(publicApiRemoteErrorCodes);
|
|
|
|
export const isPublicApiRemoteErrorCode = (
|
|
code: string
|
|
): code is PublicApiRemoteErrorCode => publicApiRemoteErrorCodeSet.has(code);
|