Skip to main content
May 20, 2009
Question

Coldfusion and Flex Error Handling

  • May 20, 2009
  • 1 reply
  • 1516 views

Hello! I was wondering if someone could point me in the right direction regarding error handling in a Flex app thats using an HTTPSERVICE RPC to a Coldfusion component.

If a user is entering form data in Flex and clicks submit... the data is sent via the HTTPSERVICE send method as XML to the CFC. But what if there is a Coldfusion SQL insert statement error? Say a user enters a character in a number field (now i know the best thing to do would be to have actionscript ensure that the values entered are numbers but lets keep that aside just for this example). How could I alert the user to let them know the CFC encountered a SQL error? Or better yet... alert them that everything went "A" ok and their data was successfully submitted.

I originally thought to put CFTRY and CFCATCH around the CFC code. I could do that fine, but had trouble passing back a message string so that FLEX could use it in an Alert.Show window.

Thanks!

-BosDog

This topic has been closed for replies.

1 reply

September 12, 2009

Flex can use the errors thrown by CFTHROW.  If your cfc is using cfscript and CF9 you can now just use Throw();

One note though.  This is how I throw back errors to Flex when I am using Remote Objects.  Not sure if it handles it the same way with HTTPService.  But I assume that it would be very similar.

-Joe