File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -308,11 +308,7 @@ var Raven = {
308
308
* @return {Raven }
309
309
*/
310
310
setExtraContext : function ( extra ) {
311
- if ( isUndefined ( extra ) ) {
312
- delete globalContext . extra ;
313
- } else {
314
- globalContext . extra = objectMerge ( globalContext . extra || { } , extra ) ;
315
- }
311
+ mergeContext ( 'extra' , extra ) ;
316
312
317
313
return Raven ;
318
314
} ,
@@ -324,11 +320,7 @@ var Raven = {
324
320
* @return {Raven }
325
321
*/
326
322
setTagsContext : function ( tags ) {
327
- if ( isUndefined ( tags ) ) {
328
- delete globalContext . tags ;
329
- } else {
330
- globalContext . tags = objectMerge ( globalContext . tags || { } , tags ) ;
331
- }
323
+ mergeContext ( 'tags' , tags ) ;
332
324
333
325
return Raven ;
334
326
} ,
@@ -933,4 +925,12 @@ function urlencode(o) {
933
925
return pairs . join ( '&' ) ;
934
926
}
935
927
928
+ function mergeContext ( key , context ) {
929
+ if ( isUndefined ( context ) ) {
930
+ delete globalContext [ key ] ;
931
+ } else {
932
+ globalContext [ key ] = objectMerge ( globalContext [ key ] || { } , context ) ;
933
+ }
934
+ }
935
+
936
936
afterLoad ( ) ;
You can’t perform that action at this time.
0 commit comments