User Guide

1068 Chapter 7: ColdFusion C++ CFX Reference
Example
The following example retrieves the query that was passed to the tag. If no query was passed, an
exception is thrown:
CCFXQuery* pQuery = pRequest->GetQuery() ;
if ( pQuery == NULL )
{
pRequest->ThrowException(
"Missing QUERY parameter",
"You must pass a QUERY parameter in "
"order for this tag to work correctly." ) ;
}
CCFXRequest::ReThrowException
Syntax
void CCFXRequest::ReThrowException(CCFXException* e)
Description
Re-throws an exception that has been caught within an extension procedure. This function is
used to avoid having C++ exceptions that are thrown by DLL extension code propagate back into
ColdFusion. Catch ALL C++ exceptions that occur in extension code, and either re-throw them
(if they are of the
CCFXException class) or create and throw a new exception pointer using
CCFXRequest::ThrowException.
Parameters
Example
The following code demonstrates how to handle exceptions in ColdFusion Extension DLL
procedures:
try
{
...Code that could throw an exception...
}
catch( CCFXException* e )
{
...Do appropriate resource cleanup here...
// Re-throw the exception
pRequest->ReThrowException( e ) ;
}
catch( ... )
{
// Something nasty happened
pRequest->ThrowException(
"Unexpected error occurred in CFX tag", "" ) ;
}
Parameter Description
e A CCFXException that has been caught