You are here

public function MigrationBase::errorHandler in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/base.inc \MigrationBase::errorHandler()

Custom PHP error handler. TODO: Redundant with hook_watchdog?

Parameters

$error_level: The level of the error raised.

$message: The error message.

$filename: The filename that the error was raised in.

$line: The line number the error was raised at.

$context: An array that points to the active symbol table at the point the error occurred.

File

includes/base.inc, line 739
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

public function errorHandler($error_level, $message, $filename, $line, $context) {
  if ($error_level & error_reporting()) {
    $message .= "\n" . t('File !file, line !line', array(
      '!line' => $line,
      '!file' => $filename,
    ));

    // Record notices and continue
    if ($error_level == E_NOTICE || $error_level == E_USER_NOTICE) {
      $this
        ->saveMessage($message . "(file: {$filename}, line {$line})", MigrationBase::MESSAGE_INFORMATIONAL);
    }
    elseif (!($error_level == E_STRICT || $error_level == 8192 || $error_level == 16384)) {
      throw new MigrateException($message, MigrationBase::MESSAGE_ERROR);
    }
  }
}