1. #1
    Sencha Premium Member
    Join Date
    Mar 2008
    Posts
    145
    Vote Rating
    2
    kworam is on a distinguished road

      0  

    Default callback function parameters

    callback function parameters


    Pardon me if this is a newbie question: I have implemented an Ext.Direct handler on my ASP.NET website and I am able to successfully call it from my Sencha Touch 2 application. When I make the call to the Ext.Direct server method, I pass a callback function that takes two parameters: 'data' and 'trans'.

    I am now trying to implement error handling in the callback function. When no server exception occurs, the return value of the server method is received in 'data'. When a server exception does occur, 'data' is null and the Chrome debugger shows that the '_message' member of the 'trans' object contains an error message. I can't find any documentation of the 'trans' parameter and how to properly use it for error detection and handling. Could someone point me to the appropriate documentation?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,812
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The trans parameter is most like the Ext.direct.Transaction instance.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2008
    Posts
    145
    Vote Rating
    2
    kworam is on a distinguished road

      0  

    Default not intended for use

    not intended for use


    Thanks. I looked up Ext.direct.Transaction in the docs and found it described as a 'Supporting Class for Ext.Direct (not intended to be used directly)'. This makes me think I shouldn't use it in my code.

    While looking at the Ext.direct docs, I noticed Ext.direct.ExceptionEvent which is described as 'An event that is fired when an exception is received from a Ext.direct.RemotingProvider'. This looks promising. Should I use this to detect exceptions in the server method? If so, is there any sample code that demonstrates how to register for the event and properly handle it?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,812
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You should be able to use the on() method on the provider
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1