We had the very same discussion last week. One of our developers made the valid comment, that Method2 is less readable, because both success and error are returned in the same ResultDTO. So we decided to go with Method1. Our delegate wraps the expected business errors into a BusinessException. The fault handler can analyze the type of the exception and specifically handle business errors, while other errors are passed to a default handler.
Cheers Ralf. -- Ralf Bokelberg <[EMAIL PROTECTED]> Flex & Flash Consultant based in Cologne/Germany On Sat, May 10, 2008 at 5:26 PM, Mike Chabot <[EMAIL PROTECTED]> wrote: > I'm wondering what people do to pass friendly messages for handled > errors to Flex. Examples of handled errors are you try to log in and > your password is wrong, or maybe you try to buy a product that is no > longer in stock. I'm looking at server communication via Remoting, if > that matters. > > [Method 1] > I see experienced programmers throwing server exceptions for > unsuccessful conditions to pass strings such as "incorrect password" > to Flex, such that the RemoteObject result handler deals with > successful logins and the RemoteObject fault handler deals with failed > logins. The majority of examples I see use this technique. In the > ColdFusion world, this is done using cfthrow. > > [Method 2] > Another method is to handle both successful and unsuccessful logins > using the result handler, and only handle unexpected server failures > using the fault handler. So when you try to log in, instead of > returning a Boolean value, you return a structure with possibly a > success key (Boolean) and a message key (String). This is the method I > am used to using with Web services. I'm seeing enough programmers > recommending cfthrow combined with the fault handler, however, that > I'm starting to wonder whether there is some place which says that > throwing server exceptions to pass validation failure messages is the > better method. > > Does anyone have any thoughts on this? > > Thank you, > Mike Chabot > >

