mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
chore(core): Better debug logs for local dev (#11096)
This commit is contained in:
@@ -5,17 +5,13 @@ interface ErrorReporter {
|
||||
report: (error: Error | string, options?: ReportingOptions) => void;
|
||||
}
|
||||
|
||||
const { NODE_ENV } = process.env;
|
||||
const inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
||||
|
||||
const instance: ErrorReporter = {
|
||||
report: (error) => {
|
||||
if (error instanceof Error) {
|
||||
let e = error;
|
||||
do {
|
||||
const meta = e instanceof ApplicationError ? e.extra : undefined;
|
||||
if (inDevelopment) console.log(e, meta);
|
||||
else Logger.error(`${e.constructor.name}: ${e.message}`, meta);
|
||||
Logger.error(`${e.constructor.name}: ${e.message}`, meta);
|
||||
e = e.cause as Error;
|
||||
} while (e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user