<cfset var cfcatch = "" /> 
Yeah...var'ing cfcatch doesn't work.  Trust me I've tried.  Maybe Sean Corfield would be willing to answer this one.

Because I'm stumped on this one.  I wonder if this would work:

<cffunction name=... >
    <cfset var localCatch = "" />
    <cftry>
      <!--- Some code that could produce an error


        --->
    <cfcatch type="database">
        <!--- Open script block --->
        <cfscript>
        localCatch = Duplicate(cfcatch);
        // Duplicate entry - Legacy(X/Open) and SQL Standard for cross DB compat.
        if (localCatch.SQLState EQ "S1009" XOR localCatch.SQLState EQ 23000) {
            // do other code
            return localCatch;
        } // END IF
        // All other DB errors
        else {
            // DO OTHER ERROR HANDLING etc.
        } // END ELSE
        </cfscript>
    </cfcatch>
    </cftry>
</cffunction>

.Peter

John Farrar wrote:
Good question... but an error in a block of <cftry's> would trap out to
nested <cfcatch> tags... so unless you can achieve two errors executing side
by side... the chances are mild that you will have threading issues. You
would have to have the error occur before the cfcatch variables are
dumped... pretty milli fast... so it will take some fancy testing to get the
answer to that question. MM could answer that better than any of us... they
can look at the code.

John

----- Original Message ----- 
From: "Kola Oyedeji" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 04, 2004 8:05 PM
Subject: Re: [CFCDev] CFC catch "global" scope


  
Hmmm interesting question. I'd be interested to know if

<cfset var cfcatch = "" >

...has any effect? One option may be to lock the code so that that
portion of code is never executed by multiple threads, however
depending on how often the code is run single threading it, that could
potentially effect performance.

KOla



On Fri, 03 Sep 2004 18:15:03 -0400, Peter J. Farrell
<[EMAIL PROTECTED]> wrote:
    
I have a try/catch block in one of my CFCs.  It cannot be var'ed into
the "private" scope....

If I want to return the cfcatch "global" scope back from my CFC in a
structure using duplicate(cfcatch).

EX.

      <cfcatch type="database">
            <!--- Open script block --->
            <cfscript>
                // Duplicate entry - Legacy(X/Open) and SQL Standard for
cross DB compat. --->
                if (cfcatch.SQLState EQ "S1009" XOR cfcatch.SQLState EQ
23000) {
                // Erase Access_ID to "null"
                    Access_ID = "";
                    return duplicate(cfcatch);
                } // END IF
                // All other DB errors
                else {
                    // DO OTHER ERROR HANDLING etc.
                } // END ELSE
            </cfscript>
      </cfcatch>

If this thread safe?

a big TIA,
.peter
.maepub
      

Reply via email to