Issue #3202665 by danflanagan8, Ratan Priya, rupertj, longwave, smustgrave, thursday_bw: "A(n) object was thrown while attempting to stub." Hard to debug migration message
parent
eaa010f97a
commit
2e76fda4ff
|
@ -263,7 +263,7 @@ class MigrationLookup extends ProcessPluginBase implements ContainerFactoryPlugi
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
catch (\Exception $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) {
|
if ($destination_ids) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Drupal\Tests\migrate\Unit\process;
|
namespace Drupal\Tests\migrate\Unit\process;
|
||||||
|
|
||||||
|
use Drupal\migrate\MigrateException;
|
||||||
use Drupal\migrate\MigrateSkipProcessException;
|
use Drupal\migrate\MigrateSkipProcessException;
|
||||||
use Drupal\migrate\Plugin\MigrationInterface;
|
use Drupal\migrate\Plugin\MigrationInterface;
|
||||||
use Drupal\migrate\Plugin\migrate\process\MigrationLookup;
|
use Drupal\migrate\Plugin\migrate\process\MigrationLookup;
|
||||||
|
@ -60,6 +61,12 @@ class MigrationLookupTest extends MigrationLookupTestCase {
|
||||||
$migration = MigrationLookup::create($this->prepareContainer(), $configuration, '', [], $migration_plugin->reveal());
|
$migration = MigrationLookup::create($this->prepareContainer(), $configuration, '', [], $migration_plugin->reveal());
|
||||||
$result = $migration->transform(1, $this->migrateExecutable, $this->row, '');
|
$result = $migration->transform(1, $this->migrateExecutable, $this->row, '');
|
||||||
$this->assertEquals(2, $result);
|
$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, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue