You are here

function fb_log_exception in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 5.2 fb.module \fb_log_exception()
  2. 6.3 fb.module \fb_log_exception()
  3. 6.2 fb.module \fb_log_exception()
  4. 7.4 fb.module \fb_log_exception()

Convenience function to log and report exceptions.

38 calls to fb_log_exception()
fb_admin_get_app_info in ./fb.admin.inc
fb_admin_set_properties_form_submit in ./fb.admin.inc
Confirm form submit function. We don't use fb_app_set_app_properties, because fb_app.module may not be enabled.
fb_api_check_session in ./fb.module
Sometimes calls to fb_api_init succeed, but calls to the client api will fail because cookies are obsolete or what have you. This function makes a call to facebook to test the session. Expensive, so use only when necessary.
fb_api_init in ./fb.module
Include and initialize Facebook's PHP SDK.
fb_app_fb_admin in ./fb_app.admin.inc
Implements hook_fb_admin().

... See full list

File

./fb.module, line 1688
This is the core required module of Drupal for Facebook.

Code

function fb_log_exception($e, $text = '', $fb = NULL) {
  if ($text) {
    $message = $text . ': ' . $e
      ->getMessage();
  }
  else {
    $message = $e
      ->getMessage();
  }
  if ($code = $e
    ->getCode()) {
    $message = "(#{$code}) {$message}";
  }
  if ($fb) {
    $message .= '. (' . t('logged into facebook as %fbu', array(
      '%fbu' => $fb
        ->getUser(),
    )) . ')';
  }
  if (fb_verbose()) {
    $message .= '<pre>' . $e . '</pre>';
  }
  watchdog('fb', $message, array(), WATCHDOG_ERROR);
  if (user_access(FB_PERM_ADMINISTER)) {
    drupal_set_message($message, 'error');
  }
}