@@ -21,7 +21,7 @@ describe('applyAggregateErrorsToEvent()', () => {
21
21
test ( 'should not do anything if event does not contain an exception' , ( ) => {
22
22
const event : Event = { exception : undefined } ;
23
23
const eventHint : EventHint = { originalException : new Error ( ) } ;
24
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
24
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
25
25
26
26
// no changes
27
27
expect ( event ) . toStrictEqual ( { exception : undefined } ) ;
@@ -30,15 +30,15 @@ describe('applyAggregateErrorsToEvent()', () => {
30
30
test ( 'should not do anything if event does not contain exception values' , ( ) => {
31
31
const event : Event = { exception : { values : undefined } } ;
32
32
const eventHint : EventHint = { originalException : new Error ( ) } ;
33
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
33
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
34
34
35
35
// no changes
36
36
expect ( event ) . toStrictEqual ( { exception : { values : undefined } } ) ;
37
37
} ) ;
38
38
39
39
test ( 'should not do anything if event does not contain an event hint' , ( ) => {
40
40
const event : Event = { exception : { values : [ ] } } ;
41
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , undefined ) ;
41
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , undefined ) ;
42
42
43
43
// no changes
44
44
expect ( event ) . toStrictEqual ( { exception : { values : [ ] } } ) ;
@@ -47,7 +47,7 @@ describe('applyAggregateErrorsToEvent()', () => {
47
47
test ( 'should not do anything if the event hint does not contain an original exception' , ( ) => {
48
48
const event : Event = { exception : { values : [ ] } } ;
49
49
const eventHint : EventHint = { originalException : undefined } ;
50
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
50
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
51
51
52
52
// no changes
53
53
expect ( event ) . toStrictEqual ( { exception : { values : [ ] } } ) ;
@@ -62,7 +62,7 @@ describe('applyAggregateErrorsToEvent()', () => {
62
62
const event : Event = { exception : { values : [ exceptionFromError ( stackParser , originalException ) ] } } ;
63
63
const eventHint : EventHint = { originalException } ;
64
64
65
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , key , 100 , event , eventHint ) ;
65
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , key , 100 , event , eventHint ) ;
66
66
expect ( event ) . toStrictEqual ( {
67
67
exception : {
68
68
values : [
@@ -108,7 +108,7 @@ describe('applyAggregateErrorsToEvent()', () => {
108
108
const event : Event = { exception : { values : [ exceptionFromError ( stackParser , originalException ) ] } } ;
109
109
const eventHint : EventHint = { originalException } ;
110
110
111
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
111
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
112
112
113
113
// no changes
114
114
expect ( event ) . toStrictEqual ( { exception : { values : [ exceptionFromError ( stackParser , originalException ) ] } } ) ;
@@ -127,7 +127,7 @@ describe('applyAggregateErrorsToEvent()', () => {
127
127
}
128
128
129
129
const eventHint : EventHint = { originalException } ;
130
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , key , 5 , event , eventHint ) ;
130
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , key , 5 , event , eventHint ) ;
131
131
132
132
// 6 -> one for original exception + 5 linked
133
133
expect ( event . exception ?. values ) . toHaveLength ( 5 + 1 ) ;
@@ -153,7 +153,7 @@ describe('applyAggregateErrorsToEvent()', () => {
153
153
const event : Event = { exception : { values : [ exceptionFromError ( stackParser , fakeAggregateError ) ] } } ;
154
154
const eventHint : EventHint = { originalException : fakeAggregateError } ;
155
155
156
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
156
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
157
157
expect ( event . exception ?. values ?. [ event . exception . values . length - 1 ] ?. mechanism ?. type ) . toBe ( 'instrument' ) ;
158
158
} ) ;
159
159
@@ -170,7 +170,7 @@ describe('applyAggregateErrorsToEvent()', () => {
170
170
const event : Event = { exception : { values : [ exceptionFromError ( stackParser , fakeAggregateError1 ) ] } } ;
171
171
const eventHint : EventHint = { originalException : fakeAggregateError1 } ;
172
172
173
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , 'cause' , 100 , event , eventHint ) ;
173
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , 'cause' , 100 , event , eventHint ) ;
174
174
expect ( event ) . toStrictEqual ( {
175
175
exception : {
176
176
values : [
@@ -254,7 +254,7 @@ describe('applyAggregateErrorsToEvent()', () => {
254
254
const event : Event = { exception : { values : [ exceptionFromError ( stackParser , originalException ) ] } } ;
255
255
const eventHint : EventHint = { originalException } ;
256
256
257
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , undefined , key , 100 , event , eventHint ) ;
257
+ applyAggregateErrorsToEvent ( exceptionFromError , stackParser , key , 100 , event , eventHint ) ;
258
258
expect ( event ) . toStrictEqual ( {
259
259
exception : {
260
260
values : [
@@ -293,53 +293,4 @@ describe('applyAggregateErrorsToEvent()', () => {
293
293
} ,
294
294
} ) ;
295
295
} ) ;
296
-
297
- test ( 'should truncate the exception values if they exceed the `maxValueLength` option' , ( ) => {
298
- const originalException : ExtendedError = new Error ( 'Root Error with long message' ) ;
299
- originalException . cause = new Error ( 'Nested Error 1 with longer message' ) ;
300
- originalException . cause . cause = new Error ( 'Nested Error 2 with longer message with longer message' ) ;
301
-
302
- const event : Event = { exception : { values : [ exceptionFromError ( stackParser , originalException ) ] } } ;
303
- const eventHint : EventHint = { originalException } ;
304
-
305
- const maxValueLength = 15 ;
306
- applyAggregateErrorsToEvent ( exceptionFromError , stackParser , maxValueLength , 'cause' , 10 , event , eventHint ) ;
307
- expect ( event ) . toStrictEqual ( {
308
- exception : {
309
- values : [
310
- {
311
- type : 'Error' ,
312
- value : 'Nested Error 2 ...' ,
313
- mechanism : {
314
- exception_id : 2 ,
315
- handled : true ,
316
- parent_id : 1 ,
317
- source : 'cause' ,
318
- type : 'chained' ,
319
- } ,
320
- } ,
321
- {
322
- type : 'Error' ,
323
- value : 'Nested Error 1 ...' ,
324
- mechanism : {
325
- exception_id : 1 ,
326
- handled : true ,
327
- parent_id : 0 ,
328
- source : 'cause' ,
329
- type : 'chained' ,
330
- } ,
331
- } ,
332
- {
333
- type : 'Error' ,
334
- value : 'Root Error with...' ,
335
- mechanism : {
336
- exception_id : 0 ,
337
- handled : true ,
338
- type : 'instrument' ,
339
- } ,
340
- } ,
341
- ] ,
342
- } ,
343
- } ) ;
344
- } ) ;
345
296
} ) ;
0 commit comments