Skip to content
Snippets Groups Projects
Verified Commit 3cd84c3f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #2969551 by quietone, mikelutz, joachim, benjifisher, catch: Migrate...

Issue #2969551 by quietone, mikelutz, joachim, benjifisher, catch: Migrate messages from caught exceptions need file and line details

(cherry picked from commit c915bfe0)
parent 63971d55
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
......@@ -189,7 +189,11 @@ public function import() {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: @e', ['@e' => $e->getMessage()]), 'error');
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
'@e' => $e->getMessage(),
'@file' => $e->getFile(),
'@line' => $e->getLine(),
]), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
......@@ -269,8 +273,11 @@ public function import() {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: @e',
['@e' => $e->getMessage()]), 'error');
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
'@e' => $e->getMessage(),
'@file' => $e->getFile(),
'@line' => $e->getLine(),
]), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
......
......@@ -66,12 +66,16 @@ public function testImportWithFailingRewind() {
$source->expects($this->once())
->method('rewind')
->will($this->throwException(new \Exception($exception_message)));
// The exception message contains the line number where it is thrown. Save
// it for the testing the exception message.
$line = (__LINE__) - 3;
$this->migration->expects($this->any())
->method('getSourcePlugin')
->will($this->returnValue($source));
// Ensure that a message with the proper message was added.
$exception_message .= " in " . __FILE__ . " line $line";
$this->message->expects($this->once())
->method('display')
->with("Migration failed with source plugin exception: " . Html::escape($exception_message));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment