I suggest you ...

Support capturing browser JavaScript exceptions in Application Insights

I would like to be able to capture browser JavaScript exceptions in Application Insights in a manner similar to server-side exceptions.

32 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Robert CannonRobert Cannon shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Joshua Weber - msftJoshua Weber - msft commented  ·   ·  Flag as inappropriate

        This is a feature that we are currently investigating. We are looking to incorporate this into the JavaScript SDK. As a question, what data about a JS exception is most valuable when you view this data?

      • Jose Antonio SilvaJose Antonio Silva commented  ·   ·  Flag as inappropriate

        It's curious that a documentation image http://cdn1.visualstudio.com/dynimg/IC718642.png contains a "Errors" category, but my current dashboard /_appanalytics/_usage/featureinsights#application=api.smartdocumentor.net&id=pages&title=Errors&_a=usageView does not catch that.
        Maybe Microsoft removed that before release.
        BTW: We also did the same as Kevin, but I would expect a out-of-the-box exception handler helper in the current "Usage" lib

      • Kevin SnowKevin Snow commented  ·   ·  Flag as inappropriate

        Started to do something like this with the stub below. It saves all the errors off, the problem is I can't figure out how to get the charts to report like I would like. Ideally I'd like to be able to deep drive on all "Javascript\Error" events. Ie - click on that specific error/event and get the line number/url associated with it). Better yet get the browser/os when it occurred. Of course maybe you can do that, I just haven't figured out how to do it yet. Anyway, here is the stub:

        window.onerror = function(message, url, lineNumber) {
        /// <summary>Track all javascript errors to Application Insights</summary>

        if (appInsights) {
        var jsError = {
        javaScriptErrorMessage = message,
        javaScriptErrorLineNumber = lineNumber,
        javaScriptErrorUrl = url
        };

        appInsights.logEvent(
        "Javascript/Error",
        jsError
        );
        }
        }

      Feedback and Knowledge Base