Skip to content

Commit 9220438

Browse files
committed
Logger look for previous structurally not nominally
1 parent 1cbee39 commit 9220438

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/core/logger/formatters.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as stacktrace from 'stack-trace';
1010
import { MESSAGE } from 'triple-beam';
1111
import { fileURLToPath } from 'url';
1212
import { config, format, LogEntry } from 'winston';
13-
import { Exception } from '../../common/exceptions';
13+
import { hasPrevious } from '~/common';
1414
import { maskSecrets as maskSecretsOfObj } from '../../common/mask-secrets';
1515
import { getNameFromEntry } from './logger.interface';
1616

@@ -77,9 +77,7 @@ export const exceptionInfo = () =>
7777
delete info.stack;
7878

7979
const flatten = (ex: Error): Error[] =>
80-
ex instanceof Exception && ex.previous
81-
? [ex, ...flatten(ex.previous)]
82-
: [ex];
80+
hasPrevious(ex) ? [ex, ...flatten(ex.previous)] : [ex];
8381

8482
info.exceptions = flatten(info.exception).map((ex): ParsedError => {
8583
const { name: _, message, stack: __, ...other } = ex;

0 commit comments

Comments
 (0)