mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
fix(cli): improve cli dependency error clarity
This commit is contained in:
+22
-5
@@ -49,6 +49,13 @@ import { FlowFile, replaceInlineScripts } from "./flow.ts";
|
||||
import { getIsWin } from "./main.ts";
|
||||
import { FlowValue } from "./gen/types.gen.ts";
|
||||
|
||||
export class LockfileGenerationError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'LockfileGenerationError';
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateAllMetadata() { }
|
||||
|
||||
function findClosestRawReqs(
|
||||
@@ -376,9 +383,16 @@ async function updateScriptLock(
|
||||
const response = JSON.parse(responseText);
|
||||
const lock = response.lock;
|
||||
if (lock === undefined) {
|
||||
throw new Error(
|
||||
`Failed to generate lockfile. Full response was: ${JSON.stringify(
|
||||
response
|
||||
if (response?.["error"]?.["message"]) {
|
||||
throw new LockfileGenerationError(
|
||||
`Failed to generate lockfile: ${response?.["error"]?.["message"]}`
|
||||
);
|
||||
}
|
||||
throw new LockfileGenerationError(
|
||||
`Failed to generate lockfile: ${JSON.stringify(
|
||||
response,
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
);
|
||||
}
|
||||
@@ -395,8 +409,11 @@ async function updateScriptLock(
|
||||
metadataContent.lock = "";
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Failed to generate lockfile. Status was: ${rawResponse.statusText}, ${responseText}, ${e}`
|
||||
if (e instanceof LockfileGenerationError) {
|
||||
throw e;
|
||||
}
|
||||
throw new LockfileGenerationError(
|
||||
`Failed to generate lockfile:${rawResponse.statusText}, ${responseText}, ${e}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -990,7 +990,7 @@ const command = new Command()
|
||||
.action(bootstrap as any)
|
||||
.command(
|
||||
"generate-metadata",
|
||||
"re-generate the metadata file updating the lock and the script schema (for flows, use `wmill flow generate - locks`)"
|
||||
"re-generate the metadata file updating the lock and the script schema (for flows, use `wmill flow generate-locks`)"
|
||||
)
|
||||
.arguments("[script:file]")
|
||||
.option("--yes", "Skip confirmation prompt")
|
||||
|
||||
Reference in New Issue
Block a user