2
0

🚸 Display error toast when script or set vari…

This commit is contained in:
Baptiste Arnaud
2024-06-11 18:18:05 +02:00
parent d80b3eaddb
commit 233ff91a57
15 changed files with 151 additions and 50 deletions

View File

@ -6,6 +6,7 @@ import { safeStringify } from '@typebot.io/lib/safeStringify'
import { Variable } from './types'
import ivm from 'isolated-vm'
import { parseTransferrableValue } from './codeRunners'
import { stringifyError } from '@typebot.io/lib/stringifyError'
const defaultTimeout = 10 * 1000
@ -74,7 +75,6 @@ export const executeFunction = async ({
try {
const output = await run(parsedBody)
console.log('Output', output)
return {
output: safeStringify(output) ?? '',
newVariables: Object.entries(updatedVariables)
@ -93,12 +93,7 @@ export const executeFunction = async ({
console.log('Error while executing script')
console.error(e)
const error =
typeof e === 'string'
? e
: e instanceof Error
? e.message
: JSON.stringify(e)
const error = stringifyError(e)
return {
error,