fix: use recette status log

This commit is contained in:
2026-03-18 10:33:18 +01:00
parent c12387ac94
commit 0a73c5cb37
4 changed files with 230 additions and 51 deletions

View File

@@ -107,6 +107,12 @@ type ScriptResult = {
downloadFolders: string[]
}
type ApiErrorLike = {
data?: {
statusMessage?: string
}
}
const emit = defineEmits<{
result: [payload: ScriptResult]
}>()
@@ -171,7 +177,15 @@ const runScript = async (key: string) => {
downloadFolders: data.downloadFolders || []
})
} catch (error: unknown) {
message.value = (error as any)?.data?.statusMessage || "Erreur execution script"
const errorMessage =
typeof error === "object" &&
error !== null &&
"data" in error &&
typeof (error as ApiErrorLike).data?.statusMessage === "string"
? (error as ApiErrorLike).data?.statusMessage
: null
message.value = errorMessage || "Erreur execution script"
emit("result", {
key,
label: scripts.value.find((item) => item.key === key)?.label || key,