You are here

function slack_watchdog_sending_error in Slack 7

Same name and namespace in other branches
  1. 6 includes/pages/slack.pages.inc \slack_watchdog_sending_error()

Function to sending error for watchdog.

Create a log in watchdog containing Slack's response information when message sending was failed.

1 call to slack_watchdog_sending_error()
slack_send_test_message_form_submit in includes/pages/slack.pages.inc
Submit handler for slack test message form.

File

includes/pages/slack.pages.inc, line 194
Slack module page functions.

Code

function slack_watchdog_sending_error($result) {
  $message = '';
  $status_message = $result->status_message;
  if (isset($status_message)) {
    $message .= "<strong>Error message:</strong> {$status_message}";
  }
  $code = $result->code;
  if (isset($code)) {
    $message .= "<br /><strong>Code:</strong> {$code}";
  }
  $request = $result->request;
  if (isset($request)) {
    $message .= "<br /><strong>Request:</strong> {$request}";
  }
  $headers = $result->headers;
  if (isset($headers)) {
    $message .= "<br /><br /><strong>Headers:</strong><br><ul>";
    foreach ($headers as $key => $header) {
      $message .= "<li>{$key}: {$header}</li>";
    }
    $message .= '</ul>';
  }
  watchdog('slack', $message, array(), WATCHDOG_ERROR);
}