Fix automation tests.
This commit is contained in:
parent
19f58b62c9
commit
831c81a99c
|
@ -1,11 +1,18 @@
|
|||
import { Ctx } from "@budibase/types"
|
||||
import { IsolatedVM } from "../../jsRunner/vm"
|
||||
import { iifeWrapper } from "@budibase/string-templates"
|
||||
import { iifeWrapper, UserScriptError } from "@budibase/string-templates"
|
||||
|
||||
export async function execute(ctx: Ctx) {
|
||||
const { script, context } = ctx.request.body
|
||||
const vm = new IsolatedVM()
|
||||
ctx.body = vm.withContext(context, () => vm.execute(iifeWrapper(script)))
|
||||
try {
|
||||
ctx.body = vm.withContext(context, () => vm.execute(iifeWrapper(script)))
|
||||
} catch (err: any) {
|
||||
if (err.code === UserScriptError.code) {
|
||||
throw err.userScriptError
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export async function save(ctx: Ctx) {
|
||||
|
|
Loading…
Reference in New Issue