You are here

protected function MigrateExecutable::handleException in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::handleException()

Takes an Exception object and both saves and displays it.

Pulls in additional information on the location triggering the exception.

Parameters

\Exception $exception: Object representing the exception.

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

1 call to MigrateExecutable::handleException()
MigrateExecutable::import in core/modules/migrate/src/MigrateExecutable.php
Performs an import operation - migrate items from source to destination.
1 method overrides MigrateExecutable::handleException()
TestMigrateExecutable::handleException in core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
Takes an Exception object and both saves and displays it.

File

core/modules/migrate/src/MigrateExecutable.php, line 452

Class

MigrateExecutable
Defines a migrate executable class.

Namespace

Drupal\migrate

Code

protected function handleException(\Exception $exception, $save = TRUE) {
  $result = Error::decodeException($exception);
  $message = $result['@message'] . ' (' . $result['%file'] . ':' . $result['%line'] . ')';
  if ($save) {
    $this
      ->saveMessage($message);
  }
  $this->message
    ->display($message, 'error');
}