You are here

public static function cf_error::failed_to_load in Common Functionality 7.2

Reports that something was unable to load.

@see: watchdog() @see: watchdog_severity_levels()

Parameters

string $item: The name of the item that could not be loaded.

int $severity: (optional) The severity of the message, as per RFC 3164. Possible values are WATCHDOG_ERROR, WATCHDOG_WARNING, etc.

Return value

cf_error_code A object containing the processed error, with specified backtrace.

File

modules/cf_error/classes/cf_error.php, line 800
Provides the derror exception class.

Class

cf_error

Code

public static function failed_to_load($item, $severity = WATCHDOG_ERROR) {
  $error = new cf_error_code();
  if (empty($item)) {
    if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
      $backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, self::p_backtrace_limit());
    }
    else {
      $backtrace = debug_backtrace();
    }
    $item = self::p_report_invalid_argument_string('item', $backtrace);
    unset($backtrace);
  }
  $error
    ->set_severity($severity);
  self::p_load_backtrace($error);
  self::p_failed_to($error, 'load', $item);
  return $error;
}