Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/plus-1231_add_exceptions…
Browse files Browse the repository at this point in the history
…_to_error_handler_logger' into 1.0-wapstart
  • Loading branch information
Andrey Ryaguzov committed Apr 8, 2014
2 parents 3241363 + 15d1aa7 commit 01ccc53
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions global.inc.php.tpl
Expand Up @@ -13,12 +13,26 @@

function error2Exception($code, $string, $file, $line, $context)
{
$traceMessage = $string;
$backTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if (isset($backTrace[0]['file']) && isset($backTrace[0]['line'])) {
$traceMessage .= ' in '.$backTrace[0]['file'].' on line '.$backTrace[0]['line'];
$isException = false;
$exceptionPatterns = array(
'/geoip_country_code_by_name.+Host.+not found/iu',
);
foreach ($exceptionPatterns as $pattern) {
if (preg_match($pattern, $string)) {
$isException = true;
break;
}
}

if (!$isException) {
$traceMessage = $string;
$backTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if (isset($backTrace[0]['file']) && isset($backTrace[0]['line'])) {
$traceMessage .= ' in '.$backTrace[0]['file'].' on line '.$backTrace[0]['line'];
}
//error_log($traceMessage . PHP_EOL . print_r($backTrace, true));
}
//error_log($traceMessage . PHP_EOL . print_r($backTrace, true));

throw new BaseException($string, $code);
}

Expand All @@ -32,7 +46,7 @@

throw new ClassNotFoundException(sprintf('"%s": "%s"', $classname, $message));
}

// file extensions
define('EXT_CLASS', '.class.php');
define('EXT_TPL', '.tpl.html');
Expand Down

0 comments on commit 01ccc53

Please sign in to comment.