@devp0nt/error0 1.0.0-next.53 → 1.0.0-next.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,10 +11,9 @@ export const stackMergePlugin = ({
11
11
  }
12
12
  return error
13
13
  .causes()
14
- .map((cause) => {
15
- return cause instanceof Error ? cause.stack : undefined
14
+ .flatMap((cause) => {
15
+ return cause instanceof Error && cause.stack && typeof cause.stack === 'string' ? cause.stack : []
16
16
  })
17
- .filter((value): value is string => typeof value === 'string')
18
17
  .join(delimiter)
19
18
  },
20
19
  })
@@ -11,7 +11,7 @@ describe('tagsPlugin', () => {
11
11
  const leaf = new AppError('leaf', { tags: ['api', 'retry'], cause: root })
12
12
  expect(leaf.tags).toEqual(['api', 'retry', 'db'])
13
13
  expectTypeOf(leaf.tags).toEqualTypeOf<string[] | undefined>()
14
- expectTypeOf(leaf.own('tags')).toEqualTypeOf<string[] | undefined>()
14
+ expectTypeOf(leaf.own?.tags).toEqualTypeOf<string[] | undefined>()
15
15
  expectTypeOf(leaf.flow('tags')).toEqualTypeOf<Array<string[] | undefined>>()
16
16
  })
17
17