MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / variablesErrorMessage

Function variablesErrorMessage

packages/cli/src/utils/variables.ts:96–122  ·  view source on GitHub ↗
(error: VariablesParseError)

Source from the content-addressed store, hash-verified

94}
95
96function variablesErrorMessage(error: VariablesParseError): { title: string; message: string } {
97 switch (error.kind) {
98 case "conflict":
99 return {
100 title: "Conflicting variables flags",
101 message: "Use either --variables or --variables-file, not both.",
102 };
103 case "read-error":
104 return {
105 title: "Could not read --variables-file",
106 message: `${error.path}: ${error.cause}`,
107 };
108 case "parse-error":
109 return {
110 title:
111 error.source === "file"
112 ? "Invalid JSON in --variables-file"
113 : "Invalid JSON in --variables",
114 message: error.cause,
115 };
116 case "shape-error":
117 return {
118 title: "Invalid variables payload",
119 message: 'Variables must be a JSON object (e.g. {"title":"Hello"}).',
120 };
121 }
122}
123
124/**
125 * Resolve `--variables` / `--variables-file` into a plain object, or

Callers 1

resolveVariablesArgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected