Вот пример кода:
/**
 * Глобальный отлов серверных ошибок (для таблиц grid).
 */
Ext.define('Pir.core.app.domain.PirReaderJson', {
    extend: 'Ext.app.EventDomain',
    singleton: true,
    
    requires: [
        'Pir.core.data.reader.Json'
    ],
    
    type: 'pirReaderJson',
	prefix: 'pirReaderJson.',
	idMatchRe: /^\#/,
    
    constructor: function() {
        var me = this;
        
        me.callParent();
        me.monitor(Pir.core.data.reader.Json);
    },
    match: function(target, selector) {
        var result = false;
        //var  alias = target.alias;
        
        if (selector === '*') {
            result = true;
        }
		
		//  else if (this.idMatchRe.test(selector)) {
        //     result = target.getStoreId() === selector.substring(1);
        // } else if (alias) {
        //     result = Ext.Array.indexOf(alias, this.prefix + selector) > -1;
        // }
        return result;
    }
});
/**
 * Этот класс создан для работы домена Pir.core.app.domain.PirReaderJson.
 */
Ext.define("Pir.core.data.reader.Json", {
	extend: "Ext.data.reader.Json",
	alias: "reader.pir-json",
	getResponseData: function() {
		var result = this.callParent(arguments);
		if (result.ErrorCode != "1") {
			this.fireEvent("pirerror", result.ErrorDescription, result);
		}
		return result;
	}
});
/**
 * The main application class. An instance of this class is created by app.js when it
 * calls Ext.application(). This is the ideal place to handle application launch and
 * initialization details.
 */
Ext.define('PirDesktopFirst.Application', {
    extend: 'Ext.app.Application',
    
    name: 'PirDesktopFirst',
	controllers: ["Pir.core.controller.Root"],
    stores: [
        // TODO: add global / shared stores here
    ],
    
    launch: function () {
        Pir.Core.selectServer("first");
    },
    onAppUpdate: function () {
        Ext.Msg.confirm('Application Update', 'This application has an update, reload?',
            function (choice) {
                if (choice === 'yes') {
                    window.location.reload();
                }
            }
        );
    }
});
Ext.define("Pir.core.controller.Root", {
	
	extend: "Ext.app.Controller",
	requires: ["Pir.core.app.domain.PirReaderJson"],
	
	init: function() {
		this.listen({
			pirReaderJson: {
				"*": {
					pirerror: this.onPirReaderJsonEvent
				}
			}
		});
	},
	onPirReaderJsonEvent: function(errorDescription, result) {
		Ext.toast({
			html: errorDescription,
			title: 'Ошибка на сервере',
			width: 400
		});
	}
});