public function HandleException(\Exception $exception) { if ($this->IsValidRequest()) { ExceptionHandler()->Log($exception); $this->IsValidRequest(false); } }
function ErrorToExceptionWrapper($errno, $errstr, $errfile, $errline) { global $CONFIG; if ($errno == (E_NOTICE || E_USER_NOTICE) && $CONFIG['Developer_Debug'] || $errno == (E_ERROR || E_WARNING || E_PARSE)) { // since the error handler cannot throw new exceptions properly, we need to // use the dirty, dirty hack of calling the exception handler directly. ExceptionHandler(new GeneralException($errstr . " in file " . $errfile . " on line " . $errline)); } }
function ErrorHandler($severity, $message, $fileName, $lineNo) { global $_app_extensions_loaded; try { throw new ErrorException($message, 0, $severity, $fileName, $lineNo); } catch (Exception $exception) { if ($_app_extensions_loaded === true) { ExceptionHandler()->Log($exception); } else { if ((bool) ($severity & ini_get('error_reporting'))) { error_log($message, 0); } return false; } } return false; }
ExceptionHandler('Template error', $e); } catch (DbQueryException $e) { // Ошибка обработки запроса ExceptionHandler('Database error', $e); } catch (DbChangeDatabaseException $e) { // Ошибка переключения базы данных ExceptionHandler('Database [change operation] error', $e); } catch (DbException $e) { // Другая ошибка базы данных ExceptionHandler('Database [unknown error] error', $e); } catch (CustomException $e) { // Любое другое исключение ExceptionHandler('Custom error', $e); } catch (Exception $e) { // Любое другое исключение ExceptionHandler('Unknown error', $e); // Exception // CustomExeption // !common/classes/DbTable.php(45) // !common/classes/DbTable.php (114) // KTemplateException // DbException // DbConnectException // DbChangeDatabaseException // DbQueryException } function ExceptionHandler($errmess, $e) { echo $errmess . ': ' . $e->getMessage(); dbg($e->getTrace(), '<pre>' . my_exeption_trace($e) . '</pre>'); my_die($e);
} $domainname = $obDomain->Name; $listaddress = hmailGetVar("listaddress", ""); $listactive = hmailGetVar("listactive", "0"); $listrequiresmtpauth = hmailGetVar("listrequiresmtpauth", "0"); $RequireSenderAddress = hmailGetVar("RequireSenderAddress", ""); $Mode = hmailGetVar("Mode", ""); $obList->Address = $listaddress . "@" . $domainname; $obList->RequireSMTPAuth = $listrequiresmtpauth; $obList->Active = $listactive; $obList->RequireSenderAddress = $RequireSenderAddress; $obList->Mode = $Mode; try { $obList->Save(); } catch (Exception $exception) { ExceptionHandler($exception); die; } $distributionlistid = $obList->ID; header("Location: index.php?page=distributionlist&action=edit&domainid={$domainid}&distributionlistid={$distributionlistid}"); function IsAddAllowed($obDomain) { if (!$obDomain->MaxNumberOfDistributionListsEnabled) { return 0; } if ($obDomain->DistributionLists->Count >= $obDomain->MaxNumberOfDistributionLists) { return STR_DISTRIUBTIONLIST_COULD_NOT_BE_ADDED_MAX_REACHED; } return 0; } ?>
function ErrorHandler($level, $message, $file, $line, $context = NULL) { ExceptionHandler(new ErrorException($message, 0, $level, $file, $line)); }