mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Consolidate path-related errors in Sentry (no-changelog) (#7757)
Keep reporting [path-related errors](https://n8nio.sentry.io/issues/4649493725) in Sentry but consolidate them in a single error group. Also, add `options.extra` as `meta` so they remain visible in debug logs: ``` 2023-11-24T11:50:54.852Z | error | ReportableError: Something went wrong "{ test: 123, file: 'LoggerProxy.js', function: 'exports.error' }" ``` --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
export class FileNotFoundError extends Error {
|
||||
constructor(readonly filePath: string) {
|
||||
super(`File not found: ${filePath}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class BinaryFileNotFoundError extends FileNotFoundError {}
|
||||
|
||||
export class InvalidPathError extends Error {
|
||||
constructor(readonly filePath: string) {
|
||||
super(`Invalid path detected: ${filePath}`);
|
||||
}
|
||||
}
|
||||
21
packages/core/src/errors/filesystem.errors.ts
Normal file
21
packages/core/src/errors/filesystem.errors.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ReportableError } from 'n8n-workflow';
|
||||
|
||||
abstract class FileSystemError extends ReportableError {
|
||||
constructor(message: string, filePath: string) {
|
||||
super(message, { extra: { filePath } });
|
||||
}
|
||||
}
|
||||
|
||||
export class FileNotFoundError extends FileSystemError {
|
||||
constructor(filePath: string) {
|
||||
super('File not found', filePath);
|
||||
}
|
||||
}
|
||||
|
||||
export class BinaryFileNotFoundError extends FileNotFoundError {}
|
||||
|
||||
export class InvalidPathError extends FileSystemError {
|
||||
constructor(filePath: string) {
|
||||
super('Invalid path detected', filePath);
|
||||
}
|
||||
}
|
||||
1
packages/core/src/errors/index.ts
Normal file
1
packages/core/src/errors/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { BinaryFileNotFoundError, FileNotFoundError, InvalidPathError } from './filesystem.errors';
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
|
||||
|
||||
export * from './errors';
|
||||
export * from './ActiveWorkflows';
|
||||
export * from './BinaryData/BinaryData.service';
|
||||
export * from './BinaryData/types';
|
||||
|
||||
Reference in New Issue
Block a user