diff --git a/frontend/src/lib/components/TemplateEditor.svelte b/frontend/src/lib/components/TemplateEditor.svelte index f570a20a71..a7f5225b7b 100644 --- a/frontend/src/lib/components/TemplateEditor.svelte +++ b/frontend/src/lib/components/TemplateEditor.svelte @@ -382,6 +382,10 @@ export let fixedOverflowWidgets = true export let fontSize = 16 + if (typeof code != 'string') { + code = '' + } + const lang = 'template' const dispatch = createEventDispatcher() diff --git a/frontend/src/lib/components/flows/utils.ts b/frontend/src/lib/components/flows/utils.ts index 0c1e89acf8..d9a54c5cc3 100644 --- a/frontend/src/lib/components/flows/utils.ts +++ b/frontend/src/lib/components/flows/utils.ts @@ -92,7 +92,7 @@ export async function loadSchemaFromModule(module: FlowModule): Promise<{ if (JSON.stringify(keys.sort()) !== JSON.stringify(Object.keys(input_transforms).sort())) { input_transforms = keys.reduce((accu, key) => { - let nv = input_transforms[key] ?? { + let nv = input_transforms[key] ?? (module.id == 'failure' && ['message', 'name'].includes(key)) ? { type: 'javascript', expr: `error.${key}` } : { type: 'static', value: undefined } diff --git a/frontend/src/lib/script_helpers.ts b/frontend/src/lib/script_helpers.ts index d80247fb1e..ed9de28696 100644 --- a/frontend/src/lib/script_helpers.ts +++ b/frontend/src/lib/script_helpers.ts @@ -102,7 +102,7 @@ export async function main(x: string) { } ` -export const DENO_FAILURE_MODULE_CODE = ` +export const DENO_FAILURE_MODULE_CODE = `// flow is considered recovered and a success unless an exception is thrown export async function main(message: string, name: string) { const flow_id = Deno.env.get("WM_FLOW_JOB_ID") @@ -119,8 +119,7 @@ def main(x: str): ` export const PYTHON_FAILURE_MODULE_CODE = `import os - -# connect the error parameter to 'previous_result.error' +# flow is considered recovered and a success unless an exception is raised def main(message: str, name: str): flow_id = os.environ.get("WM_FLOW_JOB_ID")