You are here

public function TestMigrateExecutable::handleException in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php \Drupal\Tests\migrate\Unit\TestMigrateExecutable::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.

Overrides MigrateExecutable::handleException

File

core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php, line 60

Class

TestMigrateExecutable
Tests MigrateExecutable.

Namespace

Drupal\Tests\migrate\Unit

Code

public function handleException(\Exception $exception, $save = TRUE) {
  $message = $exception
    ->getMessage();
  if ($save) {
    $this
      ->saveMessage($message);
  }
  $this->message
    ->display($message);
}