QErrorHandler::HandleException PHP Method

HandleException() public static method

public static HandleException ( Exception $objException )
$objException Exception
    public static function HandleException(Exception $objException)
    {
        // If we still have access to QApplicationBase, set the error flag on the Application
        if (class_exists('QApplicationBase')) {
            QApplicationBase::$ErrorFlag = true;
        }
        // If we are currently dealing with reporting an error, don't go on
        if (QErrorHandler::$Type) {
            return;
        }
        // Setup the QErrorHandler Object
        QErrorHandler::$Type = 'Exception';
        $objReflection = new ReflectionObject($objException);
        QErrorHandler::$Message = $objException->getMessage();
        QErrorHandler::$ObjectType = $objReflection->getName();
        QErrorHandler::$Filename = $objException->getFile();
        QErrorHandler::$LineNumber = $objException->getLine();
        QErrorHandler::$StackTrace = trim($objException->getTraceAsString());
        // Special Setup for Database Exceptions
        if ($objException instanceof QDatabaseExceptionBase) {
            QErrorHandler::$ErrorAttributeArray[] = new QErrorAttribute('Database Error Number', $objException->ErrorNumber, false);
            if ($objException->Query) {
                QErrorHandler::$ErrorAttributeArray[] = new QErrorAttribute('Query', $objException->Query, true);
            }
        }
        // Sepcial Setup for DataBind Exceptions
        if ($objException instanceof QDataBindException) {
            if ($objException->Query) {
                QErrorHandler::$ErrorAttributeArray[] = new QErrorAttribute('Query', $objException->Query, true);
            }
        }
        QErrorHandler::Run();
    }

Usage Example

Example #1
0
function __qcodo_handle_exception(Exception $objException)
{
    return QErrorHandler::HandleException($objException);
}