Solved

CFTHROW alternative

Posted on 2011-09-22
4
480 Views
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">
    </cfif>
</cffunction>

Open in new window

0
Comment
Question by:Lee R Liddick Jr
[X]
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
4 Comments
 
LVL 3

Accepted Solution

by:
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">
    </cfif>
</cffunction>

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>
  <cfcase value='end'>

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

Expert Comment

by:gdemaria
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...
<cfscript>
    // if you want to throw a database error:
    throw('database');
</cfscript>

0
 

Author Comment

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

Expert Comment

by:gdemaria
ID: 36587079
it's an odd one...
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to go to Web page 2 140
setup wamp server for first time 2 116
WebSite Direction 1 79
Customising IE behaviour on certain pages 2 99
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

734 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