refactor(core): Diverge syntax error handling in expressions (#5124)

*  Diverge syntax error handling in expressions

* ✏️ Expand comment
This commit is contained in:
Iván Ovejero 2023-01-11 12:15:42 +01:00 committed by GitHub
parent af55ecd64b
commit 044b153275
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -298,6 +298,17 @@ export class Expression {
throw error;
}
}
// Syntax errors resolve to `Error` on the frontend and `null` on the backend.
// This is a temporary divergence in evaluation behavior until we make the
// breaking change to allow syntax errors to fail executions.
if (
typeof process === 'undefined' &&
error instanceof Error &&
error.name === 'SyntaxError'
) {
throw new Error('invalid syntax');
}
}
return null;
}