Пример #1
0
/**
 * Exception Handler set in Kurogo::initialize()
 */
function exceptionHandlerForProduction(Exception $exception)
{
    $bt = $exception->getTrace();
    array_unshift($bt, array('line' => $exception->getLine(), 'file' => $exception->getFile()));
    Kurogo::log(LOG_ALERT, sprintf("A %s has occured: %s", get_class($exception), $exception->getMessage()), "exception", $bt);
    if ($exception instanceof KurogoException) {
        $sendNotification = $exception->shouldSendNotification();
    } else {
        $sendNotification = true;
    }
    if ($sendNotification) {
        $to = Kurogo::getSiteVar('DEVELOPER_EMAIL');
        if (!Kurogo::deviceClassifier()->isSpider() && $to) {
            mail($to, "Mobile web page experiencing problems", "The following page is throwing exceptions:\n\n" . "URL: http" . (IS_SECURE ? 's' : '') . "://" . SERVER_HOST . "{$_SERVER['REQUEST_URI']}\n" . "User-Agent: \"{$_SERVER['HTTP_USER_AGENT']}\"\n" . "Referrer URL: \"{$_SERVER['HTTP_REFERER']}\"\n" . "Exception:\n\n" . var_export($exception, true));
        }
    }
    if ($url = getErrorURL($exception)) {
        Kurogo::redirectToURL($url);
    } else {
        die("A serious error has occurred");
    }
}
Пример #2
0
/**
  * Exception Handler set in initialize.php
  */
function exceptionHandlerForProduction($exception) {
  if(!$GLOBALS['deviceClassifier']->isSpider()) {
    mail($GLOBALS['siteConfig']->getVar('DEVELOPER_EMAIL'), 
      "Mobile web page experiencing problems",
      "The following page is throwing exceptions:\n\n" .
      "URL: http".(IS_SECURE ? 's' : '')."://".SERVER_HOST."{$_SERVER['REQUEST_URI']}\n" .
      "User-Agent: \"{$_SERVER['HTTP_USER_AGENT']}\"\n" .
      "Referrer URL: \"{$_SERVER['HTTP_REFERER']}\"\n" .
      "Exception:\n\n" . 
      var_export($exception, true)
    );
  }

  header('Location: '.getErrorURL($exception));
  die(0);
}