Skip to content

Commit

Permalink
fix: ensure telefunctions to not throw a primitve as error
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jan 27, 2022
1 parent 7e727f8 commit 14698fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions telefunc/node/server/runTelefunc/executeTelefunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ async function executeTelefunction(runContext: {
let telefunctionHasErrored = false
let telefunctionAborted = false
const onError = (err: unknown) => {
assertUsage(
typeof err === 'object' && err !== null,
`The telefunction ${runContext.telefunctionExportName} (${runContext.telefunctionFilePath}) threw a non-object error: \`${err}\`. Make sure the telefunction does \`throw new Error(${err})\` instead.`,
)
if (isAbort(err)) {
telefunctionAborted = true
telefunctionReturn = err.abortValue
Expand Down

0 comments on commit 14698fc

Please sign in to comment.