function MigrateExecutable::handleException

Same name in other branches
  1. 9 core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::handleException()
  2. 8.9.x core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::handleException()
  3. 10 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 509

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.