Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


CFTHROW alternative

Posted on 2011-09-22
Medium Priority
Last Modified: 2013-12-24
I need an alternate method of CFTHROW...the environment that I am in does not allow this tag.  How do I get the same result without using CFTHROW.
<cffunction name="fullDuration" returntype="struct">
   <cfargument name="startDate" type="date">
   <cfargument name="endDate" type="date">
   <cfif dateCompare(arguments.startDate, arguments.endDate) gt 0>
        <cfthrow message="StartDate cannot be greater than EndDate">

Open in new window

Question by:Lee R Liddick Jr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

devilJinKazama earned 2000 total points
ID: 36584531
if you are using it to only display messages out to the screen, you can make a custom tag to handle that and make it look pretty as well. if you dont care about how it looks you can just use cfabort to get the same ugly blue box and display the message you want

<cffunction name="fullDuration" returntype="struct">
   <cfargument name="startDate" type="date">
   <cfargument name="endDate" type="date">
   <cfif dateCompare(arguments.startDate, arguments.endDate) gt 0>
        <cfabort showerror="StartDate cannot be greater than EndDate">

if you do make a custom tag, it would go something like this

<cfparam name="Attributes.Message" default="">

<cfswitch expression=#thisTag.ExecutionMode#>
  <cfcase value= 'start'>
    <!--- Start tag processing --->
  <cfcase value='end'>

    put fancy HTML & design here
     <cfoutput> #attributes.Message#</cfoutput>
LVL 39

Expert Comment

ID: 36584643

It seems really strange to me that they would not support cfthrow... I am curious how you verified that?   Did you get an error and they say "we don't support this.." meaning you're on your own.. or do they really mean, you can't use that tag.   I say this because the host has to catch errors, they all do... so why can't you throw on?

Did you try this...
    // if you want to throw a database error:


Author Comment

by:Lee R Liddick Jr
ID: 36586918's a shared server restriction.
LVL 39

Expert Comment

ID: 36587079
it's an odd one...

Featured Post

How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question