Problem/Motivation

Even if it not documented on the contract (\Drupal\single_content_sync\ContentImporterInterface::importFromFile()) the content import process can fail with exceptions and when the happens the batch import process dies with an error instead of gracefully continuing the import and reporting back import errors at the end.

Steps to reproduce

Simplest dirty hack to trigger an exception:

1. Log in as a super admin user
2. Navigate to the /admin/content/import page
3. Select a zip file (which was generated by exporting content previously, then by editing the .yml file in it so some required field e.g. the title is empty, then compress the zip)
4. Click on Import
5. Anticipate the complete batch import died (see attached screenshot).

Proposed resolution

Catch import errors meanwhile the batch process and report them to the user at the end.

Remaining tasks

User interface changes

API changes

I do not think so that the touched methods were covered by BC.

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mxr576 created an issue. See original summary.

mxr576’s picture

StatusFileSize
new320.28 KB

Raised an MR againts 2.0.x but the fix also applies to 1.4.x and should be merged to that branch too.

The outcome after the fix is applied.

mxr576’s picture

Status: Active » Needs review
mxr576’s picture

Test suite failed for unrelated reasons.

There were 2 failures:
1) Drupal\Tests\single_content_sync\Functional\SingleContentSyncImportTest::testSingleImport
Unable to install modules: module 'single_content_sync' is incompatible with this version of Drupal core.
/builds/issue/single_content_sync-3510655/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:505
/builds/issue/single_content_sync-3510655/web/core/tests/Drupal/Tests/BrowserTestBase.php:555
/builds/issue/single_content_sync-3510655/web/core/tests/Drupal/Tests/BrowserTestBase.php:367
/builds/issue/single_content_sync-3510655/tests/src/Functional/SingleContentSyncBrowserTestBase.php:43
2) Drupal\Tests\single_content_sync\Functional\SingleContentSyncImportUITest::testSingleImportUi
Unable to install modules: module 'single_content_sync' is incompatible with this version of Drupal core.
/builds/issue/single_content_sync-3510655/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:505
/builds/issue/single_content_sync-3510655/web/core/tests/Drupal/Tests/BrowserTestBase.php:555
/builds/issue/single_content_sync-3510655/web/core/tests/Drupal/Tests/BrowserTestBase.php:367
/builds/issue/single_content_sync-3510655/tests/src/Functional/SingleContentSyncBrowserTestBase.php:43
FAILURES!