Browse Source

fix(profiling): Catch import profile error (#50816)

In the event importing the profile errors, this ensures that we do not
crash the rest of page.
Tony Xiao 1 year ago
parent
commit
0f6702b194
1 changed files with 7 additions and 1 deletions
  1. 7 1
      static/app/views/profiling/profileGroupProvider.tsx

+ 7 - 1
static/app/views/profiling/profileGroupProvider.tsx

@@ -1,4 +1,5 @@
 import {createContext, useContext, useMemo} from 'react';
+import * as Sentry from '@sentry/react';
 
 import {importProfile, ProfileGroup} from 'sentry/utils/profiling/profile/importProfile';
 
@@ -36,7 +37,12 @@ export function ProfileGroupProvider(props: ProfileGroupProviderProps) {
     if (!props.input) {
       return LoadingGroup;
     }
-    return importProfile(props.input, props.traceID, props.type);
+    try {
+      return importProfile(props.input, props.traceID, props.type);
+    } catch (err) {
+      Sentry.captureException(err);
+      return LoadingGroup;
+    }
   }, [props.input, props.traceID, props.type]);
 
   return (