Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/MigrateBatchExecutable.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ public function prepareBatch() {
'finished' => [$this, 'finishBatch'],
];
}
else {
throw new \Exception('Migration failed.');

if ($this->enqueueException) {
throw new \Exception("Migration ({$this->migration->id()}) failed. Wrapped exception: {$this->enqueueException->getMessage()}", previous: $this->enqueueException);
}
throw new \Exception("Migration ({$this->migration->id()}) failed.");
}

/**
Expand All @@ -180,6 +182,13 @@ public function teardownMigration() {
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
}

/**
* Stash any exception encountered during enqueueing, so it can be reported.
*
* @var \Exception|null
*/
protected ?\Exception $enqueueException = NULL;

/**
* Populate the target queue with the rows of the given migration.
*
Expand Down Expand Up @@ -218,6 +227,7 @@ protected function enqueue() {
),
'error'
);
$this->enqueueException = $e;

return MigrationInterface::RESULT_FAILED;
}
Expand All @@ -232,6 +242,7 @@ protected function enqueue() {
$this->message->display(
$this->t('Migration failed with source plugin exception: @e', ['@e' => $e]), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
$this->enqueueException = $e;
return MigrationInterface::RESULT_FAILED;
}

Expand Down
Loading