<cftry> catches error but page doesn't load

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default <cftry> catches error but page doesn't load

    Hi,

    I have an issue which has me stumped. We display some dynamic content
    on our index.cfm page using SQL Server and Cold Fusion. We've had some
    issues with services restarting after windows updates, etc. so I added
    some error trapping to display default content. If I change the table
    name or datasource name to test the error trapping, it works fine, I
    get an email and the hardcoded content is displayed.


    However, today we had a problem with SQL Server not restarting after an
    update (actually it did but CF couldn't find it, but that's not my
    question). <CFTRY> caught the error and sent the email:


    Message: Error Executing Database Query.
    Detail: SQL Server
    does not exist or access denied.


    And sent me an email, but the browser was displaying 'page not found'
    error and not the CF version.


    I'm completely baffled.


    Here's the code in question, it's in the header:


    <CFTRY>


    <!--Get Factoid-->
    <cfquery datasource="data_ole" name="GetDYK">
    Select DYK from tb1 where dykID=#dykRandom#
    </cfquery>


    <cfset fDYKtext=#GetDYK.DYK#>


    <!--All errors-->


    <CFCATCH TYPE ="Any">
    <cfset fDYKtext="Despite the challenges they face, ninety-five
    percent of 2004 survey respondents would recommend their
    college
    to a friend or family member, and 86% rate their overall
    educational
    experience at the college as good or excellent.">
    <!--This mail part needs to be commented out to display in the design
    window on dreamweaver. Still works though. Don't know why....
    <cfmail to="ccos...@bbb.org" from="i...@ccsse.org" subject="!!!!Error
    on Index Page!!! EXCEPTION: #CFCATCH.type#" server="mail.utexas.edu">
    Message: #CFCATCH.message#
    Detail: #CFCATCH.detail#


    </cfmail>!-->
    </cfcatch>
    </cftry>


    <CFTRY>


    <!--Get IQ Question-->
    <cfquery datasource="ccssedata_ole" name="GetIQ">
    Select question, A, B, C, D, E from tb2 where IQID=#IQRandom#
    </cfquery>


    <cfset fIQquestion=#GetIQ.question#>
    <cfset fIQA=#GetIQ.A#>
    <cfset fIQB=#GetIQ.B#>
    <cfset fIQC=#GetIQ.C#>
    <cfset fIQD=#GetIQ.D#>
    <cfset fIQE=#GetIQ.E#>


    <!--All other errors-->
    <CFCATCH TYPE ="Any">
    <!--Use a hard coded factoid!-->
    <cfset fIQquestion="What percentage of U.S. undergraduates in public
    higher education attend community colleges?">
    <cfset fIQA="17%">
    <cfset fIQB="26%">
    <cfset fIQC="35%">
    <cfset fIQD="47%">
    <cfset fIQE="">
    <!--
    <cfmail to="ccos...@bbb.org" from="i...@ccsse.org" subject="!!!!Error
    on Index Page!!! EXCEPTION: #CFCATCH.type#" server="mail.utexas.edu">
    Message: #CFCATCH.message#
    Detail: #CFCATCH.detail#


    </cfmail>!-->
    </cfcatch>


    </cftry>


    Any thought or suggestions appreciated. Do I need to do a separate
    check for connectivity? I can't figure out why this error doesn't get
    treated the same as the other ones...

    Thanks,

    Chris




    ccosart Guest

  2. Similar Questions and Discussions

    1. problems with cftry tag
      Ok so I have set up a cftry tag before a set of if statements once it gets to one set of if statements I then use a cfthrow tag that comes to a...
    2. <CFTRY> <CFCATCH>
      I would like to know whether there's a way to obtain the SQL statement via cfcatch's like I see when I use cferror or default to the error message. ...
    3. #22519 [Fbk->NoF]: Apache catches SEGV
      ID: 22519 Updated by: sniper@php.net Reported By: thomas dot mieslinger at gls-germany dot com -Status: ...
    4. #22519 [Opn->Fbk]: Apache catches SEGV
      ID: 22519 Updated by: sniper@php.net Reported By: thomas dot mieslinger at gls-germany dot com -Status: Open...
    5. Same pattern, ereg_replace catches it, ereg doesn't
      Hi all, My guess is I miss something really dumb, but here is my problem. I want to use ereg to find some pattern, but it doesn't seems to work....
  3. #2

    Default Re: <cftry> catches error but page doesn't load

    Chris,

    You might want to put a small query in the Application.cfm that traps any
    database errors. Since the Application.cfm file is processed before the
    index.cfm page, you should solve the problem about DB connectivity.

    I hope that helps,


    drew222 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139