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.