Results 1 to 1 of 1

Thread: UX.ErrorHandler

  1. #1
    Sencha User harley.333's Avatar
    Join Date
    Mar 2007
    Posts
    286
    Vote Rating
    5
      0  

    Default UX.ErrorHandler

    Attached is UX.ErrorHandler class (this replaces my Ext.ux.ErrorHandler class for Ext3).

    I removed the "Ext" namespace so the dynamic loader will work as expected:
    Code:
    Ext.Loader.setConfig({
     enabled: true,
     paths: {
      "APP": "myApp",
      "UX": "js/libs/ux",
      "Ext": "ext/resources/src"
     }
    });
    Ext.require("UX.ErrorHandler");
    Other than that, the class itself is largely unchanged.

    Usage:
    Code:
    //1. Setup Global Error Handler
    UX.ErrorHandler.init();
    UX.ErrorHandler.on("error", function (err) {
     // build some user-friendly text
     // display the text to the user
     // log to the server
    });
    Code:
    //2. Setup Ext Error Handler
    Ext.Error.handle = UX.ErrorHandler.handleError;
    The following code has nothing to do with UX.ErrorHandler. But it demonstrates how I handle server-side exceptions within Ext in a single location.
    Code:
    //3. Setup Server-Connection Error Handler
    Ext.util.Observable.observe(Ext.data.Connection, {
     requestcomplete: function (conn, response, options) {
      if (options.isUpload && response.responseText.indexOf("{errors:") == 0) {
       // build some user-friendly text
       // display the text to the user
      }
     },
     requestexception: function (conn, response, options) {
      // build some user-friendly text
      // display the text to the user
     }
    });
    Attached Files Attached Files
    harley.333 - Harley Jones
    harley.333@gmail.com - Find me on Google Talk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •