Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Database Access / April 2009



Tip: Looking for answers? Try searching our database.

cfcatch raise_application_error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mmcarthey - 03 Apr 2009 19:05 GMT
Hello all,
I've defined a custom exception and message in a stored procedure and am
attempting to display it to the user via the cfcatch object.  The problem is
that I'm unable to easily display the message since it doesn't appear to be
easily referenced.  For example, I have defined the message "This is an
exception." but it is only available in cfcatch.detail and cfcatch.message is
only a generic error.  Is there a way to return this message without parsing?

[b]Message: [/b]Error Executing Database Query.
[b]NativeErrorCode: [/b]20101
[b]Detail: [/b][Macromedia][Oracle JDBC Driver][Oracle]ORA-20101: This is an
exception. ORA-06512: at "BLAH.BLAH", line 180 ORA-06512: at line 1
[b]ExtendedInfo: [/b]
[b]Type: [/b]Database
[b]SQLState: [/b]HY000

Thanks!
mmcarthey - 03 Apr 2009 21:37 GMT
I ended up creating a cffunction that accepts the cfcatch structure.  Since the
cfcatch structure contains the errorcode (cfcatch.NativeErrorCode) and the
message (cfcatch.Detail) I just parsed for the string and returned the value.  
Once catch is that you have to duplicate the cfcatch struct before passing.

<!--- The range of allowed custom exception values returned from
raise_application_error --->
<cfif cfcatch.NativeErrorCode gte 20000 AND cfcatch.NativeErrorCode lte 20999>
<cfoutput>
#ParseOracleError( duplicate(cfcatch) )#
</cfoutput>
</cfif>

Any questions, please ask.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.