CmsException
The CMS exception class.
class Cms\Classes\CmsException
extends Winter\Storm\Exception\ApplicationException
The exception class handles CMS related errors. Allows the masking of other exception types which uses actual source CMS files -- instead of cached files -- for their error content.
Extends
Class | Description |
---|---|
ApplicationException
|
This class represents an application exception. |
Properties
protected $compoundObject : Cms\Classes\CmsCompoundObject
A reference to a CMS object used for masking errors.
protected
static
$errorCodes
:
array
= {"100":"General","200":"INI Settings","300":"PHP Content","400":"Twig Template"}
Collection of error codes for each error distinction.
inherited public $hint : string
Hint Message to help the user with troubleshooting the error (optional).
inherited protected $className : string
Class name of the called Exception.
inherited protected $errorType : string
Error type derived from the error code. Will be 'Undefined' if no code is used.
inherited
protected
$fileContent
:
array
= []
File content relating to the exception, each value of the array is a file line number.
inherited protected $highlight : object
Cached code information for highlighting code.
inherited protected $mask : Throwable
If this exception is acting as a mask, this property stores the face exception.
Methods
public
__construct (mixed $message = null
, integer $code = 100
, Throwable $previous = null
)
Creates the CMS exception object.
Property | Type | Description |
---|---|---|
$message | mixed |
mixed
The message to display as a string, or a CmsCompoundObject that is used for using this exception as a mask for another exception type. |
$code | integer |
integer
Error code to specify the exception type: Error 100: A general exception. Error 200: Mask the exception as INI content. Error 300: Mask the exception as PHP content. Error 400: Mask the exception as Twig content. |
$previous | Throwable |
Throwable
Previous exception. |
public applyMask (Throwable $exception) : void
Masks this exception with the details of the supplied. The error code for this exception object will determine how the supplied exception is used.
Error 100: A general exception. Inherits \Winter\Storm\Exception\ExceptionBase::applyMask() Error 200: Mask the exception as INI content. Error 300: Mask the exception as PHP content. Error 400: Mask the exception as Twig content.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
The exception to modify. |
public processCompoundObject (Throwable $exception) : bool
Checks some conditions to confirm error has actually occurred due to the CMS template code, not some external code. If the error has occurred in external code, the function will return false. Otherwise return true and modify the exception by overriding it's content, line and message values to be accurate against a CMS object properties.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
The exception to modify. |
protected processIni (Throwable $exception) : bool
Override properties of an exception specific to the INI section of a CMS object.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
The exception to modify. |
protected processPhp (Throwable $exception) : bool
Override properties of an exception specific to the PHP section of a CMS object.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
The exception to modify. |
protected processTwig (Throwable $exception) : bool
Override properties of an exception specific to the Twig section of a CMS object.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
The exception to modify. |
inherited public getCallStack () : array
Returns the call stack as an array of values containing a stack information object.
with stack information, each value will be an object with these values: id - The stack ID number. code - The class and function name being called. args - The arguments passed to the code function above. file - Reference to the file containing the called code. line - Reference to the line number of the file.
inherited public getClassName () : string
Returns the class name of the called Exception.
inherited public getErrorType () : string
Returns the error type derived from the error code used.
inherited public getHighlight () : object
Generates information used for highlighting the area of code in context of the exception line number.
The highlighted block of code will be six (6) lines before and after the problem line number.
Highlight information as an object, the following keys are supplied: startLine - The starting line number, 6 lines before the error line. endLine - The ending line number, 6 lines after the error line. errorLine - The focused error line number. lines - An array of all the lines to be highlighted, each value is a line of code.
inherited public getHighlightLines () : array
Returns an array of line numbers used for highlighting the problem area of code.
This will be six (6) lines before and after the error line number.
Array of code lines.
inherited public getTrueException () : Throwable
If this exception is acting as a mask, return the face exception. Otherwise return this exception as the true one.
The underlying exception, or this exception if no mask is applied.
inherited
public
static
mask (string $message = null
, integer $code)
: void
Masks an exception with the called class. This should catch fatal and php errors.
It should always be followed by the unmask() method to remove the mask.
Property | Type | Description |
---|---|---|
$message | string |
string
Error message. |
$code | integer |
integer
Error code. |
inherited public setMask (Throwable $exception) : void
If this exception acts as a mask, sets the face for the foreign exception.
Property | Type | Description |
---|---|---|
$exception | Throwable |
Throwable
Face for the mask, the underlying exception. |
inherited public static unmask () : void
Removes the active mask from the called class.
inherited protected filterCallStack (array $traceInfo) : array
Removes the final steps of a call stack, which add no value for the user.
The following exceptions and any trace information afterwards will be filtered:
- Illuminate\Foundation\Bootstrap\HandleExceptions
Property | Type | Description |
---|---|---|
$traceInfo | array |
array
The trace information from getTrace() or debug_backtrace(). |
The filtered array containing the trace information.
inherited protected formatStackArguments (array $arguments) : string
Prepares a function or method argument list for display in HTML or text format
Property | Type | Description |
---|---|---|
$arguments | array |
array
A list of the function or method arguments |