You are here

public function MigrationBase::handleException in Migrate 6.2

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

Takes an Exception object and both saves and displays it, pulling additional information on the location triggering the exception.

Parameters

Exception $exception: Object representing the exception.

boolean $save: Whether to save the message in the migration's mapping table. Set to FALSE in contexts where this doesn't make sense.

2 calls to MigrationBase::handleException()
Migration::import in includes/migration.inc
Perform an import operation - migrate items from source to destination.
Migration::rollback in includes/migration.inc
Perform a rollback operation - remove migrated items from the destination.

File

includes/base.inc, line 546
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 handleException($exception, $save = TRUE) {
  $result = migrate_decode_exception($exception);
  $message = $result['!message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')';
  if ($save) {
    $this
      ->saveMessage($message);
  }
  self::displayMessage($message);
}