Integrating with Sencha ExtJS

Sencha’s ExtJS is a popular commercial JavaScript framework for building web and mobile applications. ExtJS provides the Ext.Error.handle method for handling errors thrown via Ext.Error.raise. These built-in capabilities to capture detailed error information that makes integrating TrackJS easy.

Ext.Error.handle = function(err) {
    var extError = new Ext.Error(err)
    window.TrackJS && TrackJS.track(extError);

    //
    Ext.log({
        msg: extError.msg,
        level: "warn",
        dump: extError,
        stack: true
    });
    //

    return true;
};
Log ExtJS errors to TrackJS
import { TrackJS } from "trackjs";

Ext.Error.handle = function(err) {
    var extError = new Ext.Error(err)
    TrackJS.track(extError);

    //
    Ext.log({
        msg: extError.msg,
        level: "warn",
        dump: extError,
        stack: true
    });
    //

    return true;
};
Log ExtJS errors to TrackJS
Ext.Error.handle = function(err) {
    var extError = new Ext.Error(err)
    window.trackJs && trackJs.track(extError);

    //
    Ext.log({
        msg: extError.msg,
        level: "warn",
        dump: extError,
        stack: true
    });
    //

    return true;
};
Log ExtJS errors to TrackJS

You can get even better errors by using the Observable methods to add extra details to the Telemetry Timeline. You can easily add it to some or all of your components.

var event = Ext.mixin.Observable.prototype.fireEvent;
Ext.mixin.Observable.prototype.fireEvent = Ext.Function.createInterceptor(event, function(msg, data) {
    window.TrackJS && TrackJS.console.info(msg + ": " + data);
    return true;
});
Instrument ExtJS Events
import { TrackJS } from "trackjs";

var event = Ext.mixin.Observable.prototype.fireEvent;
Ext.mixin.Observable.prototype.fireEvent = Ext.Function.createInterceptor(event, function(msg, data) {
    TrackJS.console.info(msg + ": " + data);
    return true;
});
Instrument ExtJS Events
var event = Ext.mixin.Observable.prototype.fireEvent;
Ext.mixin.Observable.prototype.fireEvent = Ext.Function.createInterceptor(event, function(msg, data) {
    window.trackJs && trackJs.console.info(msg + ": " + data);
    return true;
});
Instrument ExtJS Events