diff --git a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php index 06b7c9a0146..8e7ca733a9c 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php +++ b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php @@ -263,7 +263,7 @@ class MigrationLookup extends ProcessPluginBase implements ContainerFactoryPlugi throw $e; } catch (\Exception $e) { - throw new MigrateException(sprintf('A(n) %s was thrown while attempting to stub.', gettype($e)), $e->getCode(), $e); + throw new MigrateException(sprintf('%s was thrown while attempting to stub: %s', get_class($e), $e->getMessage()), $e->getCode(), $e); } } if ($destination_ids) { diff --git a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php index ca483476c1e..c022175f535 100644 --- a/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php +++ b/core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\migrate\Unit\process; +use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateSkipProcessException; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\process\MigrationLookup; @@ -60,6 +61,12 @@ class MigrationLookupTest extends MigrationLookupTestCase { $migration = MigrationLookup::create($this->prepareContainer(), $configuration, '', [], $migration_plugin->reveal()); $result = $migration->transform(1, $this->migrateExecutable, $this->row, ''); $this->assertEquals(2, $result); + + $this->migrateStub->createStub('destination_migration', [1], [], FALSE)->willThrow(new \Exception('Oh noes!')); + $migration = MigrationLookup::create($this->prepareContainer(), $configuration, '', [], $migration_plugin->reveal()); + $this->expectException(MigrateException::class); + $this->expectExceptionMessage('Exception was thrown while attempting to stub: Oh noes!'); + $migration->transform(1, $this->migrateExecutable, $this->row, ''); } /**