fix: fix script persistence in url + add support for extra error args in python

This commit is contained in:
Ruben Fiszel
2024-10-17 01:07:56 +02:00
parent bddbeb1cb0
commit fac41fd700
4 changed files with 11 additions and 3 deletions
@@ -498,7 +498,10 @@ except BaseException as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
tb = traceback.format_tb(exc_traceback)
with open(result_json, 'w') as f:
err = {{ "message": str(e), "name": e.__class__.__name__, "stack": '\n'.join(tb[1:]) }}
err = {{ "message": str(e), "name": e.__class__.__name__, "stack": '\n'.join(tb[1:]) }}
extra = e.__dict__
if extra and len(extra) > 0:
err['extra'] = extra
flow_node_id = os.environ.get('WM_FLOW_STEP_ID')
if flow_node_id:
err['step_id'] = flow_node_id
@@ -559,6 +559,11 @@
<pre class="text-xs pt-2 whitespace-pre-wrap text-primary"
>{result.error.stack ?? ''}</pre
>
{#if result.error?.extra}
<pre class="text-xs pt-2 whitespace-pre-wrap text-primary"
>{JSON.stringify(result.error.extra, null, 4)}</pre
>
{/if}
<slot />
</div>
{#if language === 'bun'}
@@ -197,7 +197,7 @@
}
$: !disableHistoryChange &&
replaceStateFn('#' + encodeState({ script, primarySchedule: $primaryScheduleStore }))
replaceStateFn('#' + encodeState({ ...script, primarySchedule: $primaryScheduleStore }))
if (script.content == '') {
initContent(script.language, script.kind, template)
@@ -39,7 +39,7 @@
return decoded
} catch (e) {
console.error('Error decoding state', e)
return defaultScript
return defaultScript()
}
}