mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-08-19 01:57:12 +02:00
Ensure all errors in `core` and `workflow` inherit from `ApplicationError` so that we start normalizing all the errors we report to Sentry Follow-up to: https://github.com/n8n-io/n8n/pull/7757#discussion_r1404338844 ### `core` package `ApplicationError` - `FileSystemError` (abstract) - `FileNotFoundError` - `DisallowedFilepathError` - `BinaryDataError` (abstract) - `InvalidModeError` - `InvalidManagerError` - `InvalidExecutionMetadataError` ### `workflow` package `ApplicationError` - `ExecutionBaseError` (abstract) - `WorkflowActivationError` - `WorkflowDeactivationError` - `WebhookTakenError` - `WorkflowOperationError` - `SubworkflowOperationError` - `CliWorkflowOperationError` - `ExpressionError` - `ExpressionExtensionError` - `NodeError` (abstract) - `NodeOperationError` - `NodeApiError` - `NodeSSLError` Up next: - Reorganize errors in `cli` - Flatten the hierarchy in `workflow` (do we really need `ExecutionBaseError`?) - Remove `ExecutionError` type - Stop throwing plain `Error`s - Replace `severity` with `level` - Add node and credential types as `tags` - Add workflow IDs and execution IDs as `extras`
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import type { IDataObject } from '../Interfaces';
|
|
import { ExecutionBaseError } from './abstract/execution-base.error';
|
|
|
|
/**
|
|
* Class for instantiating an expression error
|
|
*/
|
|
export class ExpressionError extends ExecutionBaseError {
|
|
constructor(
|
|
message: string,
|
|
options?: {
|
|
cause?: Error;
|
|
causeDetailed?: string;
|
|
description?: string;
|
|
descriptionTemplate?: string;
|
|
functionality?: 'pairedItem';
|
|
itemIndex?: number;
|
|
messageTemplate?: string;
|
|
nodeCause?: string;
|
|
parameter?: string;
|
|
runIndex?: number;
|
|
type?: string;
|
|
},
|
|
) {
|
|
super(message, { cause: options?.cause });
|
|
|
|
if (options?.description !== undefined) {
|
|
this.description = options.description;
|
|
}
|
|
|
|
const allowedKeys = [
|
|
'causeDetailed',
|
|
'descriptionTemplate',
|
|
'functionality',
|
|
'itemIndex',
|
|
'messageTemplate',
|
|
'nodeCause',
|
|
'parameter',
|
|
'runIndex',
|
|
'type',
|
|
];
|
|
if (options !== undefined) {
|
|
Object.keys(options as IDataObject).forEach((key) => {
|
|
if (allowedKeys.includes(key)) {
|
|
this.context[key] = (options as IDataObject)[key];
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|