Note that there are some explanatory texts on larger screens.

plurals
  1. POCFCATCH throwing error in CFC
    primarykey
    data
    text
    <p>For some reason, a piece of code that works fine on a <code>*.cfm</code> page, and did work fine in a <code>*.cfc</code>, now is throwing an error when error is detected.</p> <p>The error is:</p> <pre><code>Element SQL is undefined in CFCATCH. </code></pre> <p>The code block where this is getting throw looks like this:</p> <pre><code>&lt;cfcatch type="database"&gt; &lt;cfset errorMessage = " &lt;p&gt;#cfcatch.message#&lt;/p&gt; &lt;p&gt;Please send the following to a developer:&lt;/p&gt; &lt;p&gt;#cfcatch.SQL#&lt;/p&gt; &lt;--- ERROR HERE &lt;p&gt;#cfcatch.queryError#&lt;/p&gt; &lt;p&gt;#cfcatch.Where#&lt;/p&gt;"&gt; some other stuff &lt;/cfcatch&gt; </code></pre> <p>Any thoughts?</p> <p><em><strong>UPDATE</em></strong></p> <p>Using @BenKoshy suggestion, I modified my <code>&lt;cfcatch&gt;</code> statement.</p> <p>Remember K.I.S.S.? Keep It Simple Stupid</p> <p>Using his method and then modifying it, I was getting more data back than I was going use, so I went with a simple version, and it works as advertised.</p> <pre><code>&lt;cfif isDefined("cfcatch.message")&gt; &lt;cfset errorMessage = errorMessage &amp; "&lt;p&gt;#cfcatch.message#&lt;/p&gt;"&gt; &lt;/cfif&gt; &lt;cfif isDefined("cfcatch.SQL")&gt; &lt;cfset errorMessage = errorMessage &amp; "&lt;p&gt;Please send the following to a developer:&lt;/p&gt;&lt;p&gt;#cfcatch.SQL#&lt;/p&gt;"&gt; &lt;/cfif&gt; &lt;cfif isDefined("cfcatch.QueryError")&gt; &lt;cfset errorMessage = errorMessage &amp; "&lt;p&gt;#cfcatch.queryError#&lt;/p&gt;"&gt; &lt;/cfif&gt; &lt;cfif isDefined("cfcatch.Where")&gt; &lt;cfset errorMessage = errorMessage &amp; "&lt;p&gt;#cfcatch.Where#&lt;/p&gt;"&gt; &lt;/cfif&gt; </code></pre> <p>Nice and easy and it works. KISS</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload