Q_Exception Class
Represents a complex exception thrown in Q. It may contain more details.
Constructor
Q_Exception
-
[$params=array()]
-
[$inputFields=array()]
-
[$code=null]
Parameters:
-
[$params=array()]
Array optionalArray of parameters for the exception. Used in the exception message, etc. To access them later, call $e->params() You can also provide a string here, which will then be the exception message.
-
[$inputFields=array()]
Array optionalArray of names of input fields to which the exception applies.
-
[$code=null]
Array optionalOptionally pass the error code here to override the default
Item Index
Methods
- $exception
- __get
- __set
- add static
- getTraceAsStringEx
- getTraceEx
- inputFields
- params
- rethrow static
- rethrowDestClasses
- toArray static
Methods
$exception
-
$exception
Construct a Q_Exception object from an Exception.
Parameters:
-
$exception
Object
Returns:
__get
-
$param
Parameters:
-
$param
String
Returns:
__set
-
$param
-
$value
Parameters:
-
$param
String -
$value
Mixed
add
-
$className
-
$message
-
[$rethrowDestClasses=array()]
-
[$baseClassName=null]
Registers a new exception class that extends Q_Exception
Parameters:
-
$className
StringThe name of the exception class.
-
$message
StringThe description of the error. Will be eval()-ed before rendering, so it can include references to parameters, such as $my_param.
-
[$rethrowDestClasses=array()]
Array optionalThe name of the class that should handle this exception,
-
[$baseClassName=null]
String optionalHere you can pass the name of different base class than QException should it be thrown. Almost all catch() blocks in your code should use
Q<em>Exception::rethrow($e, __CLASS</em></em>)
as the first statement, if the exception might have to be re-thrown further down the stack.
getTraceAsStringEx
()
String
Returns trace as string, can be overridden. Use this in your exception reporting. This is the default implementation.
Returns:
getTraceEx
()
Array
Returns the trace array, can be overridden. Use this in your exception reporting. This is the default implementation.
Returns:
inputFields
()
Array
Returns the array of names of input fields the exception applies to.
Returns:
params
()
Array
Returns the array of parameters the exception was created with.
Returns:
rethrow
-
$exception
-
$currentClass
Use in your catch() blocks if you think the exception might have to be thrown further down the stack.
Parameters:
-
$exception
ExceptionThe exception that was thrown. It is analyzed for whether it should be re-thrown.
-
$currentClass
StringIf the $rethrowDestClasses was specified in Q_Exception::add when creating this exception's class, and it does not contain $currentClass, this function throws the exception again.
rethrowDestClasses
()
Array
Returns an array of classes to rethrow to, if any.
Returns:
toArray
-
$exceptions
Converts an exception or array of exceptions to an array
Parameters:
-
$exceptions
Exception | ArrayThe exception object or array of exceptions to convert