QCubed - A PHP5 rapid development MVC framework.
Home  |  Updates

classQCallerException

QCallerException Class Reference

Inherited by QCrossScriptingException, QCryptographyException, QDatabaseExceptionBase, QDateTimeNullException, QEmailException, QIndexOutOfRangeException, QInvalidCastException, QOptimisticLockingException, QPoParserException, QRemoteAdminDeniedException, QUndefinedPrimaryKeyException, and QUndefinedPropertyException.

List of all members.

Public Member Functions

Private Attributes


Detailed Description

This is the main exception to be thrown by any method to indicate that the CALLER is responsible for causing the exception. This works in conjunction with Qcodo's error handling/reporting, so that the correct file/line-number is displayed to the user.

So for example, for a class that contains the method GetItemAtIndex($intIndex), it is conceivable that the caller could call GetItemAtIndex(15), where 15 does not exist. GetItemAtIndex would then thrown an IndexOutOfRangeException (which extends CallerException). If the CallerException is not caught, then the Exception will be reported to the user. The CALLER (the script who CALLED GetItemAtIndex) would have that line highlighted as being responsible for calling the error.

The PHP default for exeception reporting would normally say that the "throw Exception" line in GetItemAtIndex is responsible for throwing the exception. While this is technically true, in reality, it was the line that CALLED GetItemAtIndex which is responsible. In short, this allows for much cleaner exception reporting.

On a more in-depth note, in general, suppose a method OuterMethod takes in parameters, and ends up passing those paremeters into ANOTHER method InnerMethod which could throw a CallerException. OuterMethod is responsible for catching and rethrowing the caller exception. And when this is done, IncrementOffset() MUST be called on the exception object, to indicate that OuterMethod's CALLER is responsible for the exception.

So the code snippet to call InnerMethod by OuterMethod should look like: function OuterMethod($mixValue) { try { InnerMethod($mixValue); } catch (CallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Do Other Stuff } Again, this will assure the user that the line of code responsible for the excpetion is properly being reported by the QCubed error reporting/handler.


Constructor & Destructor Documentation

QCallerException::__construct ( strMessage,
intOffset = 1 
)

The constructor of CallerExceptions. Takes in a message string as well as an optional Offset parameter (defaults to 1). The Offset specificies how many calls up the call stack is responsible for the exception. By definition, when a CallerException is called, at the very least the Caller of the most immediate function, which is 1 up the call stack, is responsible. So therefore, by default, intOffset is set to 1.

It is rare for intOffset to be set to an integer other than 1.

Normally, the Offset would be altered by calls to IncrementOffset at every step the CallerException is caught/rethrown up the call stack.

Parameters:
string $strMessage the Message of the exception
integer $intOffset the optional Offset value (currently defaulted to 1)
Returns:
CallerException the new exception

Reimplemented in QIndexOutOfRangeException, and QInvalidCastException.

References $intOffset.


Member Function Documentation

QCallerException::__get ( strName  ) 

Reimplemented in QDatabaseExceptionBase.

QCallerException::DecrementOffset (  ) 

QCallerException::IncrementOffset (  ) 

Referenced by QQ::_(), QSampleControl::__construct(), QDataGrid::__construct(), QPaginatorBase::__construct(), QListItem::__construct(), QDataGridColumn::__construct(), QDataGridBase::__construct(), QControlGrouping::__construct(), QControlBase::__construct(), QCalendar::__construct(), QEvent::__construct(), QQueryExpansion::__construct(), QQLimitInfo::__construct(), QQConditionNotBetween::__construct(), QQConditionBetween::__construct(), QQConditionNotLike::__construct(), QQConditionLike::__construct(), QQConditionNotIn::__construct(), QQConditionIn::__construct(), QQConditionLogical::__construct(), QCryptography::__construct(), QSampleControl::__get(), QPaginator::__get(), QWriteBox::__get(), QWaitIcon::__get(), QTreeNavItem::__get(), QTreeNav::__get(), QTextBoxBase::__get(), QRadioButtonList::__get(), QRadioButton::__get(), QPaginatorBase::__get(), QPaginatedControl::__get(), QListItemStyle::__get(), QListItem::__get(), QListControl::__get(), QListBoxBase::__get(), QLinkButton::__get(), QIntegerTextBox::__get(), QImageRollover::__get(), QImageLabelBase::__get(), QImageControlBase::__get(), QImageButton::__get(), QImageBase::__get(), QFormBase::__get(), QFloatTextBox::__get(), QFileControl::__get(), QFileAssetBase::__get(), QDialogBox::__get(), QDateTimeTextBox::__get(), QDateTimePicker::__get(), QDataRepeater::__get(), QDataGridRowStyle::__get(), QDataGridColumn::__get(), QDataGridBase::__get(), QControlLabel::__get(), QControlGrouping::__get(), QControlBase::__get(), QCheckBoxList::__get(), QCheckBox::__get(), QCalendarPopup::__get(), QCalendar::__get(), QButtonBase::__get(), QBlockControl::__get(), QEvent::__get(), QAlertAction::__get(), QConfirmAction::__get(), QJavaScriptAction::__get(), QAjaxAction::__get(), QServerAction::__get(), QAction::__get(), QSoapService::__get(), QSoapMethod::__get(), QSoapParameter::__get(), QRssItem::__get(), QRssFeed::__get(), QQueryBuilder::__get(), QQBaseNode::__get(), QEmailMessage::__get(), QEmailAttachment::__get(), QDateTimeSpan::__get(), QDateTime::__get(), QDatabaseIndex::__get(), QDatabaseForeignKey::__get(), QDatabaseFieldBase::__get(), QDatabaseBase::__get(), QSqlServerDatabase::__get(), QPostgreSqlDatabase::__get(), QMySqliDatabase::__get(), QMySqlDatabase::__get(), QTypeTable::__get(), QTable::__get(), QReverseReference::__get(), QRestServiceCodeGen::__get(), QReference::__get(), QManyToManyReference::__get(), QIndex::__get(), QDatabaseCodeGen::__get(), QColumn::__get(), QCodeGenBase::__get(), QSampleControl::__set(), QPaginator::__set(), QWriteBox::__set(), QWaitIcon::__set(), QTreeNavItem::__set(), QTreeNav::__set(), QTextBoxBase::__set(), QRadioButtonList::__set(), QRadioButton::__set(), QPaginatorBase::__set(), QPaginatedControl::__set(), QListItemStyle::__set(), QListItem::__set(), QListControl::__set(), QListBoxBase::__set(), QLinkButton::__set(), QIntegerTextBox::__set(), QImageRollover::__set(), QImageLabelBase::__set(), QImageControlBase::__set(), QImageButton::__set(), QImageBase::__set(), QFormBase::__set(), QFloatTextBox::__set(), QFileControl::__set(), QFileAssetBase::__set(), QDialogBox::__set(), QDateTimeTextBox::__set(), QDateTimePicker::__set(), QDataRepeater::__set(), QDataGridRowStyle::__set(), QDataGridColumn::__set(), QDataGridBase::__set(), QControlLabel::__set(), QControlBase::__set(), QCheckBoxList::__set(), QCheckBox::__set(), QCalendarPopup::__set(), QCalendar::__set(), QButtonBase::__set(), QBlockControl::__set(), QAction::__set(), QSoapMethod::__set(), QSoapParameter::__set(), QRssItem::__set(), QRssFeed::__set(), QEmailMessage::__set(), QDateTimeSpan::__set(), QDateTime::__set(), QTypeTable::__set(), QTable::__set(), QReverseReference::__set(), QRestServiceCodeGen::__set(), QReference::__set(), QManyToManyReference::__set(), QIndex::__set(), QDatabaseCodeGen::__set(), QColumn::__set(), QCodeGenBase::__set(), QDataGridBase::AddColumnAt(), QListControl::AddItemAt(), QQueryBuilder::AddJoinCustomItem(), QQueryBuilder::AddJoinItem(), QType::Cast(), QType::CastObjectTo(), QControlBase::CreatePersistent(), QPaginatedControl::DataBind(), QDatabaseCodeGen::GetColumn(), QQVirtualNode::GetColumnAlias(), QQNode::GetColumnAlias(), QQNode::GetColumnAliasHelper(), QImageControlBase::GetControlHtml(), QImageBase::GetControlHtml(), QDataGridBase::GetDataGridRowHtml(), QListControl::GetItem(), QQNode::GetValue(), QQCondition::GetWhereClause(), QI18n::Initialize(), QBaseClass::OverrideAttributes(), QDataGridBase::OverrideRowStyle(), QDataGridBase::RemoveColumn(), QListControl::RemoveItem(), QControlBase::Render(), QControlBase::RenderHelper(), QControlBase::RenderWithError(), QControl::RenderWithName(), QFormBase::Run(), QSoapService::Run(), QDateTime::setDate(), QDateTime::setTime(), QSoapService::SetupSoapMethods(), QQExpandVirtualNode::UpdateQueryBuilder(), QQConditionNot::UpdateQueryBuilder(), and QQConditionLogical::UpdateQueryBuilder().

QCallerException::setMessage ( strMessage  ) 

Referenced by QI18n::Initialize().


Member Data Documentation

QCallerException::$intOffset [private]

QCallerException::$strTraceArray [private]


The documentation for this class was generated from the following file: