Results 1 to 3 of 3

Thread: Getting Exception Message from Handler during store.sync()

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    8

    Default Getting Exception Message from Handler during store.sync()

    I'm throwing a new DirectException in my handler :

    thrownewDirectException("{ \"success\": \"false\", \"message\": \"Error message goes here.\" }");

    I also have the following sync code:

    store.sync({ success: function () { Ext.MessageBox.alert("good"); }, failure: function (batch, operation) { Ext.MessageBox.alert(operation.request.scope.reader.jsonData["message"]); }, scope: this } );
    My question is, how can I get to the exception message in the failure function?

    Thanks
    Alex

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    How is your exception being returned? What's the JSON look like?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    8

    Default

    I was just throwing exceptions at first (A DirectException type), but then I figured out I needed json:


    return new JObject( new JProperty("success", "false"), new JProperty("message", ""), new JProperty("error", "");All is good now.

Tags for this Thread

Posting Permissions

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