mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-01 05:38:33 +08:00
refactor(core): Re-parent core error subclasses away from ApplicationError (no-changelog) (#32540)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { isObjectLiteral } from '@n8n/backend-common';
|
||||
import { Container } from '@n8n/di';
|
||||
import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow';
|
||||
import { ApplicationError, ICredentials, jsonParse, UnexpectedError } from 'n8n-workflow';
|
||||
import { ICredentials, jsonParse, OperationalError, UnexpectedError } from 'n8n-workflow';
|
||||
import * as a from 'node:assert';
|
||||
|
||||
import { CREDENTIAL_ERRORS } from '@/constants';
|
||||
import { Cipher } from '@/encryption/cipher';
|
||||
|
||||
export class CredentialDataError extends ApplicationError {
|
||||
export class CredentialDataError extends OperationalError {
|
||||
constructor({ name, type, id }: Credentials<object>, message: string, cause?: unknown) {
|
||||
super(message, {
|
||||
extra: { name, type, id },
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { ApplicationError } from '@n8n/errors';
|
||||
|
||||
export abstract class BinaryDataError extends ApplicationError {}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { ApplicationError } from '@n8n/errors';
|
||||
|
||||
export abstract class FileSystemError extends ApplicationError {
|
||||
constructor(message: string, filePath: string) {
|
||||
super(message, { extra: { filePath } });
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FileSystemError } from './abstract/filesystem.error';
|
||||
import { UserError } from 'n8n-workflow';
|
||||
|
||||
export class DisallowedFilepathError extends FileSystemError {
|
||||
export class DisallowedFilepathError extends UserError {
|
||||
constructor(filePath: string) {
|
||||
super('Disallowed path detected', filePath);
|
||||
super('Disallowed path detected', { extra: { filePath } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FileSystemError } from './abstract/filesystem.error';
|
||||
import { UserError } from 'n8n-workflow';
|
||||
|
||||
export class FileNotFoundError extends FileSystemError {
|
||||
export class FileNotFoundError extends UserError {
|
||||
constructor(filePath: string) {
|
||||
super('File not found', filePath);
|
||||
super('File not found', { extra: { filePath } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApplicationError } from '@n8n/errors';
|
||||
import { UserError } from 'n8n-workflow';
|
||||
|
||||
export class InvalidExecutionMetadataError extends ApplicationError {
|
||||
export class InvalidExecutionMetadataError extends UserError {
|
||||
constructor(
|
||||
public type: 'key' | 'value',
|
||||
key: unknown,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BinaryDataError } from './abstract/binary-data.error';
|
||||
import { UserError } from 'n8n-workflow';
|
||||
|
||||
export class InvalidManagerError extends BinaryDataError {
|
||||
export class InvalidManagerError extends UserError {
|
||||
constructor(mode: string) {
|
||||
super(`No binary data manager found for: ${mode}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user