Class QEmailException
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 QCubed'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.
- Exception
- QCallerException
- QEmailException
DecrementOffset(),
IncrementOffset(),
__construct(),
__get(),
setMessage()
|
__toString(),
__wakeup(),
getCode(),
getFile(),
getLine(),
getMessage(),
getPrevious(),
getTrace(),
getTraceAsString()
|
$code,
$file,
$line,
$message
|
$BackTrace,
$Offset,
$TraceArray
|