function patterns_error_get_last in Patterns 6
Same name and namespace in other branches
- 6.2 patterns.module \patterns_error_get_last()
- 7.2 includes/error.inc \patterns_error_get_last()
- 7 includes/error.inc \patterns_error_get_last()
Check and report PHP errors during patterns execution
Parameters
$op: operation within hook_patterns() during which error occured
$key: number of the action currently proccessed
$description: description of the current action
$pattern_title: title of the pattern currently proccessed
$pattern_file: path to pattern file currently proccessed
Return value
error message if new error encountered FALSE if there are no new errors
1 call to patterns_error_get_last()
- patterns_implement_action in ./
patterns.module - Setup and run an action
File
- ./
patterns.module, line 2894 - Enables extremely simple adding/removing features to your site with minimal to no configuration
Code
function patterns_error_get_last($op, $key, $description, $pattern_title, $pattern_file) {
$error = patterns_error_set_last();
if (!empty($error) && $error['message'] != 'patterns_error') {
$types = array(
1 => 'error',
2 => 'warning',
4 => 'parse error',
8 => 'notice',
16 => 'core error',
32 => 'core warning',
64 => 'compile error',
128 => 'compile warning',
256 => 'user error',
512 => 'user warning',
1024 => 'user notice',
2048 => 'strict warning',
4096 => 'recoverable fatal error',
);
$php_error_message = $types[$error['type']] . ': ' . $error['message'] . ' in ' . $error['file'] . ' on line ' . $error['line'] . '.';
$message = t('Pattern %title (%pattern_file)<br>Action #%key: %description (op "%op")<br>PHP error occured:<br>%error', array(
'%key' => $key,
'%title' => $pattern_title,
'%op' => $op,
'%description' => $description,
'%error' => $php_error_message,
'%pattern_file' => $pattern_file,
));
return $message;
}
return FALSE;
}