954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error Handling in CFSCRIPT

Greetings.
I would like to know if there's any way that I could throw errors within a cfscript block. I have checked the Coldfusion manual, but there are only the try and catch block stated, not the throw function.
Please advise.

red_evolve
Posting Whiz
313 posts since Jun 2003
Reputation Points: 53
Solved Threads: 1
 

you should be able to use inside the block

bkendall
Junior Poster in Training
69 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

I meant, what can I use to throw errors inside functions.

<cfscript>
  function foo(){
    if(x == 0)
      // throw error
  }
</cfscript>
red_evolve
Posting Whiz
313 posts since Jun 2003
Reputation Points: 53
Solved Threads: 1
 

Sorry I misunderstood your question there. I have mostly used error tags inside of

bkendall
Junior Poster in Training
69 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

It's okay :)
Still waiting for someone who could help me with this.

red_evolve
Posting Whiz
313 posts since Jun 2003
Reputation Points: 53
Solved Threads: 1
 
It's okay :) Still waiting for someone who could help me with this.

Has been a while... but if you're still stuck you could try this.... Works for me on CF7.


throw("Error message here!");

guy_richardson
Newbie Poster
1 post since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You