CCFXException class



An abstract class that represents an exception thrown during processing of a ColdFusion Extension (CFX) procedure.

The CCFXRequest class, CCFXQuery class, and CCFXStringSet class can throw exceptions of this type. Your ColdFusion Extension code must be written to handle exceptions of this type. For more information, see CCFXRequest::ThrowException and CCFXRequest::ReThrowException.

Class methods

virtual LPCSTR GetError()

The CCFXException::GetError function returns a general error message.

virtual LPCSTR GetDiagnostics()

The CCFXException::GetDiagnostics function returns detailed error information.

CCFXException::GetError

Description

Provides basic user output for exceptions that occur during processing.

CCFXException::GetDiagnostics

Description

Provides detailed user output for exception that occur during processing.

Example

This code block shows how GetError and GetDiagnostics work with ThrowException and ReThrowException.

// Write output back to the user here... 
    pRequest->Write( "Hello from CFX_FOO2!" ) ; 
    pRequest->ThrowException("User Error", "You goof'd..."); 
     
    // Output optional debug info 
    if ( pRequest->Debug() ) 
    { 
        pRequest->WriteDebug( "Debug info..." ) ; 
    } 
     
    // Catch ColdFusion exceptions & re-raise them 
    catch( CCFXException* e ) 
    { 
        // This is how you would pull the error information 
        LPCTSTR strError = e->GetError(); 
        LPCTSTR strDiagnostic = e->GetDiagnostics(); 
     
        pRequest->ReThrowException( e ) ; 
    } 
     
    // Catch ALL other exceptions and throw them as 
    // ColdFusion exceptions (DO NOT REMOVE! -- 
    // this prevents the server from crashing in 
    // case of an unexpected exception) 
    catch( ... ) 
    { 
        pRequest->ThrowException( 
            "Error occurred in tag CFX_FOO2", 
            "Unexpected error occurred while processing tag." ) ; 
}