File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
packages/common/src/utils/analytics Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export async function initialize(dsn: string) {
2424 / e x t e n s i o n s \/ / i,
2525 / ^ c h r o m e : \/ \/ / i,
2626 ] ,
27- whitelistUrls : [ / h t t p s ? : \/ \/ ( ( u p l o a d s | w w w ) \. ) ? c o d e s a n d b o x \. i o / ] ,
27+ // whitelistUrls: [/https?:\/\/((uploads|www)\.)?codesandbox\.io/],
2828 /**
2929 * Don't send messages from the sandbox, so don't send from eg.
3030 * new.codesandbox.io or new.csb.app
@@ -35,13 +35,14 @@ export async function initialize(dsn: string) {
3535 / .* \. c s b \. a p p / ,
3636 ] ,
3737 beforeSend : ( event , hint ) => {
38- const filename =
39- event ?. exception ?. values ?. [ 0 ] ?. stacktrace ?. frames ?. [ 0 ] ?. filename ;
38+ const exception = event ?. exception ?. values ?. [ 0 ] ;
39+ const exceptionFrame = exception ?. stacktrace ?. frames ?. [ 0 ] ;
40+ const filename = exceptionFrame ?. filename ;
4041
4142 let errorMessage =
4243 typeof hint . originalException === 'string'
4344 ? hint . originalException
44- : hint . originalException . message ;
45+ : hint . originalException ? .message || exception . value ;
4546
4647 if ( typeof errorMessage !== 'string' ) {
4748 errorMessage = '' ;
@@ -78,7 +79,8 @@ export async function initialize(dsn: string) {
7879
7980 if (
8081 customError &&
81- errorMessage . startsWith ( 'Non-Error exception captured' )
82+ errorMessage . startsWith ( 'Non-Error exception captured' ) &&
83+ exception . mechanism . handled
8284 ) {
8385 // This is an error coming from the sandbox, return with no error.
8486 return null ;
Original file line number Diff line number Diff line change @@ -32,12 +32,18 @@ function loadScript() {
3232 const script = document . createElement ( 'script' ) ;
3333 script . async = true ;
3434 script . onload = resolve ;
35- script . onerror = reject ;
35+ script . onerror = ( ) => {
36+ reject ( new Error ( 'Could not load script' ) ) ;
37+ } ;
3638 script . src = '//d3qxef4rp70elm.cloudfront.net/m.js' ;
3739 document . body . appendChild ( script ) ;
38- } ) . then ( ( ) => {
39- processArray ( ) ;
40- } ) ;
40+ } )
41+ . then ( ( ) => {
42+ processArray ( ) ;
43+ } )
44+ . catch ( ( ) => {
45+ /* ignore */
46+ } ) ;
4147}
4248
4349let _hasSetAnonymousUserId = false ;
You can’t perform that action at this time.
0 commit comments