fix(core)!: Allow syntax errors and expression errors to fail executions (#6352)

* fix: Unify expression error behavior for v1

* fix: Add `package.json` to `tsconfig.build.json`

* fix: Make `isFrontend` a constant

* fix: Use CommonJS require to read version

* fix: Use `JSON.parse()` and `fs.readFileSync()`

* feat(editor): Make WF name a link on /executions (#6354)

* make wf name a link in exec view

* link color

* make wf name a link in exec view

* link color

---------

Co-authored-by: Alex Grozav <alex@grozav.com>

* fix: Try restoring inclusions in tsconfig files

* fix: Try with copy

* refactor: Switch base branch and remove global toggle

* chore: Remove unrelated changes

* chore: Restore lockfile

* fix: Ensure all expression errors fail executions

* uncaught ExpressionErrors should not fail e2e tests

---------

Co-authored-by: romainminaud <romain.minaud@gmail.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero
2023-06-08 11:06:09 +02:00
committed by कारतोफ्फेलस्क्रिप्ट™
parent 8c008f5d22
commit 1197811a1e
8 changed files with 45 additions and 62 deletions

View File

@@ -1,3 +1,4 @@
import { ExpressionError, ExpressionExtensionError } from './ExpressionError';
import type { BinaryFileType } from './Interfaces';
const readStreamClasses = new Set(['ReadStream', 'Readable', 'ReadableStream']);
@@ -127,3 +128,20 @@ export function assert<T>(condition: T, msg?: string): asserts condition {
throw error;
}
}
const IS_FRONTEND_IN_DEV_MODE =
typeof process === 'object' &&
Object.keys(process).length === 1 &&
'env' in process &&
Object.keys(process.env).length === 0;
export const IS_FRONTEND = typeof process === 'undefined' || IS_FRONTEND_IN_DEV_MODE;
export const isSyntaxError = (error: unknown): error is SyntaxError =>
error instanceof SyntaxError || (error instanceof Error && error.name === 'SyntaxError');
export const isExpressionError = (error: unknown): error is ExpressionError =>
error instanceof ExpressionError || error instanceof ExpressionExtensionError;
export const isTypeError = (error: unknown): error is TypeError =>
error instanceof TypeError || (error instanceof Error && error.name === 'TypeError');