CRM_Core_TemporaryErrorScope
in package
This is an evil, evil work-around for CRM-11043. It is used to temporarily change the error-handling behavior and then automatically restore it -- that protocol is an improvement over the current protocol (in which random bits of code will change the global error handler setting and then forget to change it back). This class and all references to it should be removed in 4.3/4.4 (when we adopt exception-based error handling).
To ensure that new errors arising during execution of the current function are immediately fatal, use:
To ensure that they throw exceptions, use:
$errorScope = CRM_Core_TemporaryErrorScope::useException();
Note that relying on this is a code-smell: it can be safe to temporarily switch to exception
Table of Contents
Properties
- $oldFrames : mixed
Methods
- __construct() : mixed
- __destruct() : mixed
- create() : CRM_Core_TemporaryErrorScope
- getActive() : mixed
- Read the active error-handler settings
- ignoreException() : CRM_Core_TemporaryErrorScope
- setActive() : mixed
- Set the active error-handler settings
- useException() : CRM_Core_TemporaryErrorScope
Properties
$oldFrames
public
static mixed
$oldFrames
Methods
__construct()
public
__construct(mixed $newFrame) : mixed
Parameters
- $newFrame : mixed
__destruct()
public
__destruct() : mixed
create()
public
static create(mixed $callback[, null $modeException = NULL ]) : CRM_Core_TemporaryErrorScope
Parameters
- $callback : mixed
- $modeException : null = NULL
Return values
CRM_Core_TemporaryErrorScopegetActive()
Read the active error-handler settings
public
static getActive() : mixed
ignoreException()
public
static ignoreException() : CRM_Core_TemporaryErrorScope
Return values
CRM_Core_TemporaryErrorScopesetActive()
Set the active error-handler settings
public
static setActive(string $frame) : mixed
Parameters
- $frame : string
useException()
public
static useException() : CRM_Core_TemporaryErrorScope