Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default fault handling

    Hey,

    is there a possibility to handle faults beyond the event.fault.faultstring
    calling methods on RemoteObjects. The fault string is usefull to give the user
    some feedback about the error/exception that occured but it is not sufficient
    for an according action in the flex client. Is there a chance to submit the
    type of the exception that has been thrown on the server side to the flex
    client? I figured out that the event.fault object has a type attribute and a
    faultcode attribute but the type attribute is always undefined and the
    faultcode is set by the axis (?) engine.

    Example:

    Consider a update-method on a remote object that is called by the flex
    client. The update-method throws:
    an IllegalArgumentException if some input argument is invalid,a
    FinderException if the object that should be updated could not be found and a
    SystemException if a technical problem occured.
    If I handle the exception in the flex client it would be nice to know for
    example if the FinderException occured because an according action would be to
    remove the object that could not be found from a data grid or tree. So a
    event.fault.type set to the exception that occured on the server side would be
    usefull to distinguish the different exceptions that can occur on a method call.

    Question:

    How can I determine the type of the exception that has been thrown on the
    server side (as a result of a method call on a remote object) when I handle
    the fault in the flex client?


    Sorry, if I bug you with some stuff that is already known.

    Bye Martin

    martin-from-le Guest

  2. Similar Questions and Discussions

    1. Error handling
      In you provide labels or line numbers in your code, you can use ERL to get the most recent label/line number. Using line numbers does slow down...
    2. Fault Handling in Flex
      Hi, I would like to reiterate a previous post from martin-from-le where he asks a question about fault handling in flex. My question reflects...
    3. Handling Roles
      I have 3 different user roles and was wonder what the best practice for handling the different output they see when going to the same page. For...
    4. Handling .xls files with PHP - can it be done?
      Hi All, Up until now, I have been importing data from Excel spreadsheets into MySQL by exporting them to either .csv files, or tab-delimited .txt...
    5. Handling Connections in ASP.NET
      Lads Am using ASP.NET, Framework 1.1 Creating a web application to read details from a MYSQL database. Am using the dbProvider to create...
  3. #2

    Default Re: fault handling

    I dont do RemoteObjects, but I found this post on another forum. The key is
    that the fault object has more properties than just faultstring.

    ****
    Sure. Say you have this POJO. If the passed in message is less than 5
    characters long, an IllegalArgumentException will be thrown with a message of
    "Test Exception":

    public class Foo {
    public String test(String message) throws java.lang.IllegalArgumentException
    {
    if (message.length() < 5) throw java.lang.IllegalArgumentException("Test
    Exception");
    return message;
    }
    }

    invoking the test() method as a RemoteObject with a message that's too short
    results in a fault in your Flex app. The event.fault object contains
    information about the fault:

    fault.type --> the type (java.lang.IllegalArgumentException)
    fault.detail --> the Exception's message (Test Exception)
    fault.faultcode --> Always SERVER.PROCESSING

    Dirk.

    ntsiii Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139