Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
martin-from-le #1
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
-
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... -
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... -
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... -
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... -
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... -
ntsiii #2
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



Reply With Quote

