简体   繁体   中英

Sentry on Internet Explorer 11

I'm using Sentry to log some errors on Javascript but while using Internet Explorer 11 I'm getting Syntax Error while configuring the scope

function addSentryTag(key, value) {
    if (Sentry) {
       Sentry.configureScope(scope => { scope.setTag(key, value);})
    }
}

I assume the problem is using the lambda expression. Is there another way to add Tags to the scope?

I dont think IE11 supports the arrow syntax => are you running your code through any compilers like babel before trying it in the browser if not?

You can try this syntax:

function addSentryTag(key, value) {
if (Sentry) {
   Sentry.configureScope(function(scope) {
     scope.setTag(tag, value)
   })
}

}

Give it a go :)

The same code without the lambda function:

function addSentryTag(key, value) {
    if (Sentry) {
       Sentry.configureScope(function(scope){ 
         scope.setTag(key, value);
       });
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM