Jeff,

Here's what I'm doing to control any errors in our Flash site. ColdFusion
CFC Method is always returning Query to Flash and it uses the cftry/cfcatch.
So if an error occured, it will go to the cfcatch "database" or "any". In
each cfcatch, I'm creating a new query with two column called "status" and
"error_message". I make status=e and error_message="An error has occured.
Sorry about it, someone is already advice of the problem and he's working on
it" and I'm  using a CFC method to advice the support group. Every time
Flash has to check to see if the FIRST row has the field status=e and if
it's the case, it displays the error_message text to the user. Otherwise it
reads the query has normal.

Hope it will help you

Stephane

here's an cfcatch example:

<cfcatch type="Database">

   <<<!--- Call the Error Handling passing good information to the support
group that will received the error exception --->
   <cfif not IsDefined("error_param")>
    <cfset error_param = ArrayNew(1)>
   </cfif>
   <cfset abend_message  = ErrorHandling.ErrorDB(

ARGUMENTS.in_callername,

ARGUMENTS.in_language_cd,
                                                                cf_template,
                                                                cf_function,
                                                                query_name,

CFCATCH.DETAIL,

CFCATCH.SQLSTATE,

query_tables,

CFCATCH.TAGCONTEXT,

query_detail,
                                                                error_param
                                                                )>
            <!--- If an error has occured, recreate the return query
variable and create
                     the first row with a status of error (e) and an
appropriate message--->
            <cfset UpdateMovieTextOut = QueryNew("status, error_message")>
            <cfset temp                           =
QueryAddRow(UpdateMovieTextOut, 1)>
            <cfset temp                           =
QuerySetCell(UpdateMovieTextOut, "status", 'e', 1)>
            <!--- The abend_message variable is coming from the template
ErrorDB.cfm or ErrorAny
                     to give to flash in the proper language something to
display to the user --->
            <cfset temp                          =
QuerySetCell(UpdateMovieTextOut, "error_message", abend_message, 1)>
</cfcatch>

----- Original Message ----- 
From: "Chris Kief" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 09, 2003 5:06 PM
Subject: RE: [CFCDev] Error Handling Best Practices - response to RE: [CFC
Dev] Error Handling Strategies


Jeff,

>From what I've found...no. The cferror tag doesn't work so a global error
handler seems out of the question. You end up with try / catch in every CFC
method.

Remoting really needs a better way to handle things. CF is great at making
things simple...this should be no different.

In Flash I usually setup an error manager that responds to onStatus events
and notifies the user of what's up. If I could just throw my own onStatus
events from CF, say from a global error template invoked by a working
cferror tag, then I could respond gracefully on the client end of things
while dealing with logging and admin notification on the server side.

chris



>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
>Of Jeff Battershall
>Sent: Wednesday, July 09, 2003 12:47 PM
>To: [EMAIL PROTECTED]
>Subject: RE: [CFCDev] Error Handling Best Practices - response to RE: [CFC
>Dev] Error Handling Strategies
>
>Thanks Ray. And thanks to everyone else who replied. But there's no way to
>"globally" or "automatically" or "auto-magically" capture the errors as
>such, right?  I don't think there is but I'm just checking to see if I've
>missed something.
>
>What happens in situations where the CFC method is supposed to return a
>query, but when an exception is thrown, a struct is sent back?  Only way I
>could see would be to set returntype to "any" in every method.  Does that
>create overhead due to Flash having to evaluate the returned object type?
>
>Jeff
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
>Of Raymond Camden
>Sent: Wednesday, July 09, 2003 2:34 PM
>To: [EMAIL PROTECTED]
>Subject: RE: [CFCDev] Error Handling Best Practices - response to RE: [CFC
>Dev] Error Handling Strategies
>
>
>I also use a custom throw in my cfc. This allows me to set ONE type for the
>entire CFC and just do this in various methods,
>
><cfset throw("You screwed up you dog-faced idiot!")>
>
>
>========================================================================
>===
>Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
>(www.mindseye.com)
>Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
>
>Email    : [EMAIL PROTECTED]
>Blog     : www.camdenfamily.com/morpheus/blog
>Yahoo IM : morpheus
>
>"My ally is the Force, and a powerful ally it is." - Yoda
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Justin Balog
>> Sent: Wednesday, July 09, 2003 1:30 PM
>> To: '[EMAIL PROTECTED]'
>> Subject: FW: [CFCDev] Error Handling Best Practices -
>> response to RE: [CFC Dev] Error Handling Strategies
>>
>>
>> Howdy,
>>
>> Concerning Error handling, Sean C. sent this reply to my
>> question (his email follows below these code samples of
>> mine), and I have run with it.  I do wrap the the methods of
>> the cfcs, and the facade cfcs to catch errors, but on error I
>> call a private method in the cfc "throw()" which handles the
>> exception by calling various other cfcs to log it, notify
>> someone, retry, whatever?  There is probably a better way to
>> do it, but this is how I am currently handling it.
>>
>> Excerpt from a cfc called by the facade cfc:
>>
>
>----------------------------------------------------------
>You are subscribed to cfcdev. To unsubscribe, send an email
>to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
>in the message of the email.
>
>CFCDev is run by CFCZone (www.cfczone.org) and supported
>by Mindtool, Corporation (www.mindtool.com).
>
>
>
>
>----------------------------------------------------------
>You are subscribed to cfcdev. To unsubscribe, send an email
>to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
>in the message of the email.
>
>CFCDev is run by CFCZone (www.cfczone.org) and supported
>by Mindtool, Corporation (www.mindtool.com).


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to