class Error in Markdown 8.2
Hierarchy
Expanded class hierarchy of Error
2 files declare their use of Error
- InstallablePluginManager.php in src/
PluginManager/ InstallablePluginManager.php - InstallablePluginTrait.php in src/
Annotation/ InstallablePluginTrait.php
File
- src/
Util/ Error.php, line 7
Namespace
Drupal\markdown\UtilView source
class Error extends CoreError {
/**
* Suppresses any errors or exceptions while executing a callback.
*
* @param callable $callback
* The callback to execute and suppress any errors or exceptions.
* @param array $exceptions
* An array of exceptions that were thrown, if any, passed by reference.
* @param int $errorTypes
* The error types to catch.
*
* @return mixed|null
* The return value of the callback.
*/
public static function suppress(callable $callback, array &$exceptions = [], $errorTypes = E_ERROR | E_RECOVERABLE_ERROR | E_USER_ERROR) {
set_error_handler(function ($severity, $message, $file, $line) {
throw new \ErrorException($message, 0, $severity, $file, $line);
}, $errorTypes);
$result = NULL;
try {
$result = $callback();
} catch (\Throwable $exception) {
$exceptions[] = $exception;
} catch (\Exception $exception) {
$exceptions[] = $exception;
}
restore_error_handler();
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Error:: |
protected static | property | An array of blacklisted functions. | |
Error:: |
public static | function | Decodes an exception and retrieves the correct caller. | |
Error:: |
constant | The error severity level. | ||
Error:: |
public static | function | Formats a backtrace into a plain-text string. | |
Error:: |
public static | function | Gets the last caller from a backtrace. | |
Error:: |
public static | function | Renders an exception error message without further exceptions. | |
Error:: |
public static | function | Suppresses any errors or exceptions while executing a callback. |