function services_client_error_mail in Services Client 7.2
Same name and namespace in other branches
- 7 services_client_error/services_client_error.module \services_client_error_mail()
Implements hook_mail().
File
- services_client_error/
services_client_error.module, line 250 - Services Client error handling, re-try and reporting.
Code
function services_client_error_mail($key, &$message, $params) {
if ($key == 'notify_errors') {
$message['subject'] = t('SC ERROR: c: !errors, site: @id (@site)', array(
'!errors' => count($params['errors']),
'@id' => services_client_get_id(),
'@site' => variable_get('site_name', 'Drupal'),
));
foreach ($params['errors'] as $error) {
$data = array();
$data['entity_type'] = $error->entity_type;
$data['entity_id'] = $error
->getEntityId();
$uri = entity_uri($error->entity_type, $error->entity);
$data['entity_url'] = url($uri['path'], $uri['options'] + array(
'absolute' => TRUE,
));
$data['error'] = $error->error_code . ' ' . $error->error_message;
if (!empty($error->eid)) {
$data['error_url'] = url('admin/structure/services_client/errors/' . $error->eid . '/log', array(
'absolute' => TRUE,
));
}
$row = array(
'------------------------------',
);
foreach ($data as $id => $val) {
$row[] = $id . ': ' . $val;
}
$message['body'][] = implode("\n", $row);
}
}
}