CFTHROW alternative

Posted on 2011-09-22
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 500 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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

631 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