Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    896
    Vote Rating
    39
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default [FIXED-EXTJSIV-566][Beta1] JS error when exception sent back from Direct method

    [FIXED-EXTJSIV-566][Beta1] JS error when exception sent back from Direct method


    Hi,

    This kind of follows on from this bug, but is something different I think.

    I'm using Ext.Direct, and am throwing a NotImplementedException from one of the methods, to test the client-side error processing.

    I override afterRequest in my DirectProxy implementation to report errors, but a bug was preventing the exception details, or indeed the correct success flag getting though. This is the bug I am trying to verify as fixed.

    Now we're not even getting that far.

    I can see my call being made, and the exception coming back in the response:
    Code:
    [{"type":"exception","tid":15,"action":"OutboundDocuments","method":"getOutboundDocuments","message":"Ext.Direct.DirectException: Error occurred while calling Direct method. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: Throwing this to test ServerProxy exception handling!\r\n   at *snip*"}]
    Then I see the JS error, "response is undefined", in Ext.data.ServerProxy.processResponse on the following line in the success false block:
    Code:
    operation.setException({
        status: response.status,
        statusText: response.statusText
    });
    With a bit of digging can see Ext.data.Connection.onComplete gets called, and has the response in it as expected.
    This calls a callback which resolves to Ext.direct.RemotingProvider.onData, passing success = true, since call resulted in a 200.

    This creates some events from the response (just one in this case, of type "exception"), and fires it in a data event.

    It then ends up calling runCallback(transaction, event, true), and this is where things get a little unstuck.
    Firstly runCallback only seems to take two args (although of course that doesn't mean much in JS but though would mention it).
    The main issue appears to be the line:
    Code:
    result = Ext.isDefined(event.result) ? event.result : event.data;
    I have neither; my event is basically (copied from Firebug with some formatting added):
    Code:
    {
    $className:
        "Ext.direct.ExceptionEvent",
    action:
        "OutboundDocuments",
    alias:
        "direct.exception",
    message:
        "Ext.Direct.DirectExcept...ectProcessor.cs:line 92",
    method:
        "getOutboundDocuments",
    status:
        false,
    tid:
        17,
    type:
        "exception"
    }
    The result that we're meant to get from our event is passed to another callback, along with the event. This ultimately calls processResponse in ServerProxy, which passes on the undefined result as its response parameter.

    Phew... got there in the end...

    As for what the fix is, I suspect its in runCallback, but not sure. Sure you guys familiar with the guts of this area know more

    Hope this lengthy post gives you enough to go on.
    Think it should be quite easy to re-produce too, just return an exception from a router.

    Cheers,
    Westy

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,842
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Thanks for the report, in the next release the exception will be set correctly with the message response.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    896
    Vote Rating
    39
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Looks good now, thanks Evan.

Similar Threads

  1. Replies: 23
    Last Post: 24 Jun 2011, 5:47 AM
  2. Replies: 2
    Last Post: 26 Apr 2011, 1:03 PM
  3. Replies: 5
    Last Post: 2 Apr 2011, 10:40 PM
  4. Replies: 1
    Last Post: 31 Mar 2011, 10:09 PM
  5. Replies: 2
    Last Post: 7 Dec 2010, 6:01 AM

Thread Participants: 1

Tags for this Thread