fix(cli): improve flow cli dependency error clarity

This commit is contained in:
Ruben Fiszel
2025-02-20 02:48:11 +01:00
parent 2c67e84abe
commit d5b3a04b0a

View File

@@ -444,8 +444,20 @@ export async function updateFlow(
try {
const res = (await rawResponse.json()) as
| { updated_flow_value: any }
| { error: { message: string } }
| undefined;
return res?.updated_flow_value;
if (rawResponse.status != 200) {
const msg = (res as any)?.["error"]?.["message"]
if (msg) {
throw new LockfileGenerationError(
`Failed to generate lockfile: ${msg}`
);
}
throw new LockfileGenerationError(
`Failed to generate lockfile: ${rawResponse.statusText}, ${responseText}`
);
}
return (res as any).updated_flow_value;
} catch (e) {
try {
responseText = await rawResponse.text();