Adding Exceptions from Javacript

5 posts, 0 answers
  1. Atle
    Atle avatar
    5 posts
    Member since:
    Oct 2013

    Posted 17 Feb 2015 Link to this post

    Hello,

    We are doing a trial of Analytics and as such try to play with all the features of the Analytics Solution.
    We are able to get the data for Features and Usage to show up correctly, but not trackException.

    We call trackException and it reports that the payload has been sent, but it never shows up?
    Is there any way we can find information about why this fails?

    Atle Bjelland     
  2. Richard Flamsholt
    Admin
    Richard Flamsholt avatar
    28 posts

    Posted 17 Feb 2015 Link to this post

    Hi Atle,

    Yes, there are indeed ways of find out why an API call will fail. I'll explain how.

    First of all, I assume you're talking about the Javascript monitor, used in your Intranet Web Client application, right?

    All API methods are designed to be used in a way where you never have to check for success of not. Not returning a status code is our way of saying that the API will always "just work" and that you should not litter your code with checks for success.

    But what if something doesn't work - if e.g. you pass in an invalid argument, say an exception object with an unparseable stacktrace? In that case the monitor will log an error message. By default it is suppressed but you can easily setup a default handler to show that message on the appropriate output channel, which for Javascript is console.out(). It's just a one-liner or two-liner, depending on your current code. You can check out how to add logging here:

    http://docs.telerik.com/platform/analytics/integration/functionality/logging

    Another useful thing could be to simply enable debugging in your browser  and watch the console output for errors. I've just recently responded to a support-case where the issue turned out to be a misspelling of the API method name. Misspellings in Javascript can happen to all of us.

    If logging doesn't reveal the issue then I'd be happy to take a look at your code and help spot the problem.

    Regards,
    Richard Flamsholt
    Telerik
     
    EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
     
  3. Atle
    Atle avatar
    5 posts
    Member since:
    Oct 2013

    Posted 17 Feb 2015 in reply to Richard Flamsholt Link to this post

    Sorry i posted a reply to this in the wrong spot.. Here it comes again

    Hi Richard

    I have enabled the logging but it reports no Errors.
    This is my test page code.

        var analyticsMonitor = null;
        var analyticsTrackException = function (exception, message) {
            if (analyticsMonitor) {
                analyticsMonitor.trackException(exception, message);
            }
        };
        $(function () {
            var settings = _eqatec.createSettings("afe9a4d68b424c2396d2e30244ce347e");
            settings.version = "1.2.3";
            settings.loggingInterface = window._eqatec.createTraceLogger();
            analyticsMonitor = window._eqatecmonitor = _eqatec.createMonitor(settings);
            window.onerror = function (message, filename, lineNumber, columnNumber, error) {
                var m = "Error thrown in: " + filename + " at line: " + lineNumber + " and column: " + columnNumber + "\r\nMessage: " + message;
                analyticsTrackException(error, m);
                return false;
            };
            analyticsMonitor.setUserID("Bob the Builder");
            analyticsMonitor.start();
            $.error("Test Error");
        });
        
    If i check console this shows:
    monitor not started
    EqatecMonitor.min.js:27 monitor has started, connecting to https://afe9a4d68b424c2396d2e30244ce347e.monitor-eqatec.com/json.ashx
    jquery.js:250 Uncaught Error: Test Error
    2 EqatecMonitor.min.js:27 Statistics was sent successfully (xhr).

    So 2 payloads has been sent to the server.
    If i check the network outputs the attached photo content is sent

  4. Richard Flamsholt
    Admin
    Richard Flamsholt avatar
    28 posts

    Posted 17 Feb 2015 Link to this post

    Hi Atle,

    Everything looks fine at your end. Thanks for providing both code and network traffic dump.

    Last week we migrated our servers and it seems I'm lacking access on the new infrastructure to explore the data further on our new server backends. Sorry about that. I will look into it tomorrow and get back to you with an explanation.

    Regards,
    Richard Flamsholt
    Telerik
     
    EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
     
  5. Richard Flamsholt
    Admin
    Richard Flamsholt avatar
    28 posts

    Posted 18 Feb 2015 Link to this post

    Hi Atle,

    I have found and fixed the issue and we have released a new version of the Javascript monitor, v3.2.146.

    The release notes will be added tomorrow. A couple of other issues have been corrected too but been released until now.

    Regards,
    Richard Flamsholt
    Telerik
     
    EQATEC Application Analytics is now Telerik Analytics. For more information on the new name, plus what's new in Telerik Analytics, please, check out the Analytics Service Announcement.
     
Back to Top