mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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,11 +1,5 @@
|
||||
import type { Primitives } from './utils';
|
||||
import * as Logger from './LoggerProxy';
|
||||
|
||||
export interface ReportingOptions {
|
||||
level?: 'warning' | 'error' | 'fatal';
|
||||
tags?: Record<string, Primitives>;
|
||||
extra?: Record<string, unknown>;
|
||||
}
|
||||
import { ReportableError, type ReportingOptions } from './errors/reportable.error';
|
||||
|
||||
interface ErrorReporter {
|
||||
report: (error: Error | string, options?: ReportingOptions) => void;
|
||||
@@ -16,7 +10,8 @@ const instance: ErrorReporter = {
|
||||
if (error instanceof Error) {
|
||||
let e = error;
|
||||
do {
|
||||
Logger.error(`${e.constructor.name}: ${e.message}`);
|
||||
const meta = e instanceof ReportableError ? e.extra : undefined;
|
||||
Logger.error(`${e.constructor.name}: ${e.message}`, meta);
|
||||
e = e.cause as Error;
|
||||
} while (e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user