Skip to content
Snippets Groups Projects
Unverified Commit f21dc669 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3254347 by murilohp, joachim, danflanagan8, quietone: Add the process...

Issue #3254347 by murilohp, joachim, danflanagan8, quietone: Add the process plugin ID to migration exception message
parent f29ceb64
No related branches found
No related tags found
No related merge requests found
......@@ -207,7 +207,7 @@ public function testDatetimeFields() {
$migration = $this->getMigration('d7_field');
$messages = iterator_to_array($migration->getIdMap()->getMessages());
$this->assertCount(5, $messages);
$msg = "d7_field:type: Can't migrate field 'field_event' with 'todate' settings. Enable the datetime_range module. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#datetime";
$msg = "d7_field:type:process_field: Can't migrate field 'field_event' with 'todate' settings. Enable the datetime_range module. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#datetime";
$this->assertSame($messages[4]->message, $msg);
}
......
......@@ -224,7 +224,7 @@ public function import() {
}
catch (MigrateException $e) {
$this->getIdMap()->saveIdMapping($row, [], $e->getStatus());
$msg = sprintf("%s:%s: %s", $this->migration->getPluginId(), $destination_property_name, $e->getMessage());
$msg = sprintf("%s:%s:%s", $this->migration->getPluginId(), $destination_property_name, $e->getMessage());
$this->saveMessage($msg, $e->getLevel());
$save = FALSE;
}
......@@ -432,6 +432,11 @@ protected function processPipeline(Row $row, string $destination, array $plugins
$new_value[] = NULL;
$break = TRUE;
}
catch (MigrateException $e) {
// Prepend the process plugin id to the message.
$message = sprintf("%s: %s", $plugin->getPluginId(), $e->getMessage());
throw new MigrateException($message);
}
}
$value = $new_value;
if ($break) {
......@@ -446,6 +451,12 @@ protected function processPipeline(Row $row, string $destination, array $plugins
$value = NULL;
break;
}
catch (MigrateException $e) {
// Prepend the process plugin id to the message.
$message = sprintf("%s: %s", $plugin->getPluginId(), $e->getMessage());
throw new MigrateException($message);
}
$multiple = $plugin->multiple();
}
}
......
......@@ -77,7 +77,7 @@ public function testExceptionThrow() {
$message = reset($messages);
$id = $migration->getPluginId();
$this->assertEquals("$id:uri: Client error: `GET $invalid_url` resulted in a `404 Not Found` response ($invalid_url)", $message->message);
$this->assertEquals("$id:uri:download: Client error: `GET $invalid_url` resulted in a `404 Not Found` response ($invalid_url)", $message->message);
$this->assertEquals(MigrationInterface::MESSAGE_ERROR, $message->level);
// Check that the second row was migrated successfully.
......
......@@ -95,7 +95,7 @@ public function testMessagesTeed() {
$executable->import();
$this->assertCount(1, $this->messages);
$id = $this->migration->getPluginId();
$this->assertSame("source_message: $id:message: 'a message' is not an array", reset($this->messages));
$this->assertSame("source_message: $id:message:concat: 'a message' is not an array", reset($this->messages));
}
/**
......@@ -112,7 +112,7 @@ public function testGetMessages() {
'msgid' => '1',
Sql::SOURCE_IDS_HASH => '170cde81762e22552d1b1578cf3804c89afefe9efbc7cc835185d7141060b032',
'level' => '1',
'message' => "$id:message: 'a message' is not an array",
'message' => "$id:message:concat: 'a message' is not an array",
];
$executable = new MigrateExecutable($this->migration, $this);
$executable->import();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment