mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Include native Python option in Code node (#18331)
This commit is contained in:
15
packages/nodes-base/nodes/Code/throw-execution-error.ts
Normal file
15
packages/nodes-base/nodes/Code/throw-execution-error.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import { isWrappableError, WrappedExecutionError } from './errors/WrappedExecutionError';
|
||||
|
||||
export function throwExecutionError(error: unknown): never {
|
||||
if (error instanceof Error) {
|
||||
throw error;
|
||||
} else if (isWrappableError(error)) {
|
||||
// The error coming from task runner is not an instance of error,
|
||||
// so we need to wrap it in an error instance.
|
||||
throw new WrappedExecutionError(error);
|
||||
}
|
||||
|
||||
throw new ApplicationError(`Unknown error: ${JSON.stringify(error)}`);
|
||||
}
|
||||
Reference in New Issue
Block a user