@@ -38,7 +38,6 @@ function createEventFiltersEventProcessor(
38
38
dsn : PUBLIC_DSN ,
39
39
...clientOptions ,
40
40
defaultIntegrations : false ,
41
- // eslint-disable-next-line deprecation/deprecation
42
41
integrations : [ integration ] ,
43
42
} ) ,
44
43
) ;
@@ -162,10 +161,91 @@ const EXCEPTION_EVENT_WITH_LINKED_ERRORS: Event = {
162
161
{
163
162
type : 'ReferenceError' ,
164
163
value : '`tooManyTreats` is not defined' ,
164
+ stacktrace : {
165
+ frames : [ { filename : 'https://secondary-error.com/' } ] ,
166
+ } ,
167
+ } ,
168
+ {
169
+ type : 'TypeError' ,
170
+ value : 'incorrect type given for parameter `chewToy`: Shoe' ,
171
+ stacktrace : {
172
+ frames : [ { filename : 'https://main-error.com/' } ] ,
173
+ } ,
174
+ } ,
175
+ ] ,
176
+ } ,
177
+ } ;
178
+
179
+ const EXCEPTION_EVENT_WITH_AGGREGATE_ERRORS : Event = {
180
+ exception : {
181
+ values : [
182
+ {
183
+ type : 'ReferenceError' ,
184
+ value : '`tooManyTreats` is not defined' ,
185
+ stacktrace : {
186
+ frames : [ { filename : 'https://secondary-error.com/' } ] ,
187
+ } ,
188
+ mechanism : {
189
+ type : 'generic' ,
190
+ exception_id : 1 ,
191
+ parent_id : 0 ,
192
+ } ,
165
193
} ,
166
194
{
167
195
type : 'TypeError' ,
168
196
value : 'incorrect type given for parameter `chewToy`: Shoe' ,
197
+ stacktrace : {
198
+ frames : [ { filename : 'https://main-error.com/' } ] ,
199
+ } ,
200
+ mechanism : {
201
+ type : 'generic' ,
202
+ exception_id : 0 ,
203
+ } ,
204
+ } ,
205
+ ] ,
206
+ } ,
207
+ } ;
208
+
209
+ const EXCEPTION_EVENT_WITH_LINKED_ERRORS_WITHOUT_STACKTRACE : Event = {
210
+ exception : {
211
+ values : [
212
+ {
213
+ type : 'ReferenceError' ,
214
+ value : '`tooManyTreats` is not defined' ,
215
+ stacktrace : {
216
+ frames : [ { filename : 'https://main-error.com/' } ] ,
217
+ } ,
218
+ } ,
219
+ {
220
+ type : 'TypeError' ,
221
+ value : 'incorrect type given for parameter `chewToy`: Shoe' ,
222
+ } ,
223
+ ] ,
224
+ } ,
225
+ } ;
226
+
227
+ const EXCEPTION_EVENT_WITH_AGGREGATE_ERRORS_WITHOUT_STACKTRACE : Event = {
228
+ exception : {
229
+ values : [
230
+ {
231
+ type : 'ReferenceError' ,
232
+ value : '`tooManyTreats` is not defined' ,
233
+ stacktrace : {
234
+ frames : [ { filename : 'https://secondary-error.com/' } ] ,
235
+ } ,
236
+ mechanism : {
237
+ type : 'generic' ,
238
+ exception_id : 1 ,
239
+ parent_id : 0 ,
240
+ } ,
241
+ } ,
242
+ {
243
+ type : 'TypeError' ,
244
+ value : 'incorrect type given for parameter `chewToy`: Shoe' ,
245
+ mechanism : {
246
+ type : 'generic' ,
247
+ exception_id : 0 ,
248
+ } ,
169
249
} ,
170
250
] ,
171
251
} ,
@@ -624,6 +704,36 @@ describe.each([
624
704
} ) ;
625
705
expect ( eventProcessor ( MESSAGE_EVENT_WITH_NATIVE_LAST_FRAME , { } ) ) . toBe ( null ) ;
626
706
} ) ;
707
+
708
+ it ( 'should apply denyUrls to the "root" error of a linked exception' , ( ) => {
709
+ const eventProcessor = createEventFiltersEventProcessor ( integrationFn , {
710
+ denyUrls : [ 'https://main-error.com' ] ,
711
+ } ) ;
712
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_LINKED_ERRORS , { } ) ) . toBe ( null ) ;
713
+ } ) ;
714
+
715
+ it ( 'should apply denyUrls to the "root" error of an aggregate exception' , ( ) => {
716
+ const eventProcessor = createEventFiltersEventProcessor ( integrationFn , {
717
+ denyUrls : [ 'https://main-error.com' ] ,
718
+ } ) ;
719
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_AGGREGATE_ERRORS , { } ) ) . toBe ( null ) ;
720
+ } ) ;
721
+
722
+ it ( 'should apply allowUrls to the "most root" exception in the event if there are exceptions without stacktrace' , ( ) => {
723
+ const eventProcessor = createEventFiltersEventProcessor ( integrationFn , {
724
+ allowUrls : [ 'https://some-error-that-is-not-main-error.com' ] ,
725
+ } ) ;
726
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_LINKED_ERRORS_WITHOUT_STACKTRACE , { } ) ) . toBe ( null ) ;
727
+ } ) ;
728
+
729
+ it ( 'should not apply allowUrls to the event when the "root" exception of an aggregate error doesn\'t have a stacktrace' , ( ) => {
730
+ const eventProcessor = createEventFiltersEventProcessor ( integrationFn , {
731
+ allowUrls : [ 'https://some-error-that-doesnt-match-anything.com' ] ,
732
+ } ) ;
733
+ expect ( eventProcessor ( EXCEPTION_EVENT_WITH_AGGREGATE_ERRORS_WITHOUT_STACKTRACE , { } ) ) . toBe (
734
+ EXCEPTION_EVENT_WITH_AGGREGATE_ERRORS_WITHOUT_STACKTRACE ,
735
+ ) ;
736
+ } ) ;
627
737
} ) ;
628
738
629
739
describe ( 'useless errors' , ( ) => {
0 commit comments