User Guide
1070 Chapter 7: ColdFusion C++ CFX Reference
Example
The following example sets the value of a variable named 'MessageSent' based on the success of
an operation performed by the custom tag:
BOOL bMessageSent;
...attempt to send the message...
if ( bMessageSent == TRUE )
{
pRequest->SetVariable( "MessageSent", "Yes" ) ;
}
else
{
pRequest->SetVariable( "MessageSent", "No" ) ;
}
CCFXRequest::ThrowException
Syntax
void CCFXRequest::ThrowException(LPCSTR lpszError,
LPCSTR lpszDiagnostics)
Description
Throws an exception and ends processing of a request. Call this function when you encounter an
error that does not allow you to continue processing the request. This function is almost always
combined with the
CCFXRequest::ReThrowException to protect against resource leaks in
extension code.
Parameters
Example
The following example throws an exception indicating that an unexpected error occurred while
processing a request:
char buffError[512] ;
wsprintf( buffError,
"Unexpected Windows NT error number %ld "
"occurred while processing request.", GetLastError() ) ;
pRequest->ThrowException( "Error occurred", buffError ) ;
Parameter Description
lpszError Short identifier for error
lpszDiagnostics Error diagnostic information