mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Reorganize error hierarchy in core and workflow packages (no-changelog) (#7820)
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`
This commit is contained in:
@@ -2,12 +2,13 @@ import { readFile, stat } from 'node:fs/promises';
|
||||
import prettyBytes from 'pretty-bytes';
|
||||
import Container, { Service } from 'typedi';
|
||||
import { BINARY_ENCODING } from 'n8n-workflow';
|
||||
import { UnknownManagerError, InvalidModeError } from './errors';
|
||||
import { InvalidModeError } from '../errors/invalid-mode.error';
|
||||
import { areConfigModes, toBuffer } from './utils';
|
||||
|
||||
import type { Readable } from 'stream';
|
||||
import type { BinaryData } from './types';
|
||||
import type { INodeExecutionData, IBinaryData } from 'n8n-workflow';
|
||||
import { InvalidManagerError } from '../errors/invalid-manager.error';
|
||||
|
||||
@Service()
|
||||
export class BinaryDataService {
|
||||
@@ -241,6 +242,6 @@ export class BinaryDataService {
|
||||
|
||||
if (manager) return manager;
|
||||
|
||||
throw new UnknownManagerError(mode);
|
||||
throw new InvalidManagerError(mode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user