require_once 'Log.php';
-/**
- * Class CRM_Exception
- */
-class CRM_Exception extends PEAR_Exception {
-
- /**
- * Redefine the exception so message isn't optional.
- *
- * Supported signatures:
- * - PEAR_Exception(string $message);
- * - PEAR_Exception(string $message, int $code);
- * - PEAR_Exception(string $message, Exception $cause);
- * - PEAR_Exception(string $message, Exception $cause, int $code);
- * - PEAR_Exception(string $message, PEAR_Error $cause);
- * - PEAR_Exception(string $message, PEAR_Error $cause, int $code);
- * - PEAR_Exception(string $message, array $causes);
- * - PEAR_Exception(string $message, array $causes, int $code);
- *
- * @param string $message exception message
- * @param int $code
- * @param Exception $previous
- */
- public function __construct($message = NULL, $code = 0, Exception $previous = NULL) {
- parent::__construct($message, $code, $previous);
- }
-
-}
-
/**
* Class CRM_Core_Error
*/
$errorDetails = CRM_Core_Error::debug('', $error, FALSE);
$template->assign_by_ref('errorDetails', $errorDetails);
- CRM_Core_Error::debug_var('Fatal Error Details', $error);
+ CRM_Core_Error::debug_var('Fatal Error Details', $error, TRUE, TRUE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
if ($config->initialized) {
if (self::$modeException) {
// CRM-11043
- CRM_Core_Error::debug_var('Fatal Error Details', $vars);
+ CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
$details = 'A fatal error was triggered';
self::backtrace();
}
- CRM_Core_Error::debug_var('Fatal Error Details', $vars);
+ CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
// If we are in an ajax callback, format output appropriately
}
catch (Exception $other) {
// if the exception-handler generates an exception, then that sucks! oh, well. carry on.
- CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other));
+ CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other), TRUE, TRUE, '', PEAR_LOG_ERR);
}
$config = CRM_Core_Config::singleton();
$vars = [
// Case C: Default error handler
// log to file
- CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE);
+ CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE, TRUE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
// print to screen
$template = CRM_Core_Smarty::singleton();
$template->assign($vars);
$content = $template->fetch('CRM/common/fatal.tpl');
+
if ($config->backtrace) {
$content = self::formatHtmlException($exception) . $content;
}
- if ($config->userFramework == 'Joomla' &&
- class_exists('JError')
- ) {
- JError::raiseError('CiviCRM-001', $content);
- }
- else {
- echo CRM_Utils_System::theme($content);
- }
+
+ echo CRM_Utils_System::theme($content);
// fin
self::abend(CRM_Core_Error::FATAL_ERROR);
* Log or return the output?
* @param string $prefix
* Prefix for output logfile.
+ * @param int $priority
+ * The log priority level.
*
* @return string
* The generated output
* @see CRM_Core_Error::debug()
* @see CRM_Core_Error::debug_log_message()
*/
- public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '') {
+ public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '', $priority = NULL) {
// check if variable is set
if (!isset($variable)) {
$out = "\$$variable_name is not set";
reset($variable);
}
}
- return self::debug_log_message($out, FALSE, $prefix);
+ return self::debug_log_message($out, FALSE, $prefix, $priority);
}
/**
CRM_Core_Error::backtrace($string, TRUE);
}
elseif (CIVICRM_DEBUG_LOG_QUERY) {
- CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log');
+ CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log', PEAR_LOG_DEBUG);
}
}
}
*/
public static function debug_query_result($query) {
$results = CRM_Core_DAO::executeQuery($query)->fetchAll();
- CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results]);
+ CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results], TRUE, TRUE, '', PEAR_LOG_DEBUG);
}
/**
CRM_Core_Error::debug($msg, $message);
}
else {
- CRM_Core_Error::debug_var($msg, $message);
+ CRM_Core_Error::debug_var($msg, $message, TRUE, TRUE, '', PEAR_LOG_DEBUG);
}
}
* @throws PEAR_Exception
*/
public static function exceptionHandler($pearError) {
- CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError));
+ CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError), TRUE, TRUE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
throw new PEAR_Exception($pearError->getMessage(), $pearError);
}
* $obj
*/
public static function nullHandler($obj) {
- CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}");
+ CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}", FALSE, '', PEAR_LOG_ERR);
CRM_Core_Error::backtrace('backTrace', TRUE);
return $obj;
}