File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
packages/datadog-instrumentations/src Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -813,19 +813,25 @@ addHook({
813
813
814
814
const page = this
815
815
816
- const isRumActive = await page . evaluate ( ( ) => {
817
- if ( window . DD_RUM && window . DD_RUM . getInternalContext ) {
818
- return ! ! window . DD_RUM . getInternalContext ( )
819
- } else {
820
- return false
821
- }
822
- } )
816
+ try {
817
+ if ( page ) {
818
+ const isRumActive = await page . evaluate ( ( ) => {
819
+ if ( window . DD_RUM && window . DD_RUM . getInternalContext ) {
820
+ return ! ! window . DD_RUM . getInternalContext ( )
821
+ } else {
822
+ return false
823
+ }
824
+ } )
823
825
824
- if ( isRumActive ) {
825
- testPageGotoCh . publish ( {
826
- isRumActive,
827
- page
828
- } )
826
+ if ( isRumActive ) {
827
+ testPageGotoCh . publish ( {
828
+ isRumActive,
829
+ page
830
+ } )
831
+ }
832
+ }
833
+ } catch ( e ) {
834
+ // ignore errors such as redirects, context destroyed, etc
829
835
}
830
836
831
837
return response
You can’t perform that action at this time.
0 commit comments