Skip to main content
Inspiring
June 17, 2008
Question

CFTRY/CFCATCH for db inserts

  • June 17, 2008
  • 2 replies
  • 373 views
We currently don't do a cftry/cfcatch for database inserts.

What is the base way to proceed with laying this out? How can you define a
custom message if the insert fails?


    This topic has been closed for replies.

    2 replies

    Participant
    June 24, 2008
    Define a function for handling error messages

    Then

    <cftry>
    <cfquery></cfquery>
    <cfcatch type="database">
    <cfscript>throwerror("Could not do xxxxx");</cfscript>
    </cfcatch>
    </cftry>

    Inspiring
    June 17, 2008
    We have one job that does this. The cfcatch part is

    <cfcatch>
    <cfmail>
    <cfdump var="#cfcatch#">


    The job runs on a schedule so we don't care about screen displays.