Skip to content

fix(import): surface real error messages in WordPress import failures#598

Merged
ascorbic merged 1 commit intoemdash-cms:mainfrom
maikunari:fix/553-surface-import-errors
Apr 16, 2026
Merged

fix(import): surface real error messages in WordPress import failures#598
ascorbic merged 1 commit intoemdash-cms:mainfrom
maikunari:fix/553-surface-import-errors

Conversation

@maikunari
Copy link
Copy Markdown
Contributor

What does this PR do?

Surfaces real exception messages in WordPress import errors instead of the generic "Failed to import item" string.

Problem

Both WordPress import paths catch per-item exceptions and replace them with a hardcoded "Failed to import item" string before adding them to the result. The actual error message is logged to the server console via console.error, but discarded from the API response.

This makes issues like #553 (where all 185 items failed) nearly impossible to diagnose remotely — every error in the admin UI looks identical regardless of root cause.

Change

Replace the hardcoded string with the actual error.message, falling back to "Failed to import item" only when no message is available:

error: error instanceof Error && error.message
    ? error.message
    : "Failed to import item",

Scope

Intentionally narrow. This does not fix #553 — it makes #553 (and future import failures) diagnosable so the root cause can be identified from user reports.

Files

  • packages/core/src/astro/routes/api/import/wordpress-plugin/execute.ts
  • packages/core/src/astro/routes/api/import/wordpress/execute.ts

Refs #553

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation and pnpm locale:extract has been run (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

N/A — server-side change only. Error messages that were previously swallowed will now appear in the admin UI's import results.

…emdash-cms#553)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: 3c0c804

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 16, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@598

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@598

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@598

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@598

emdash

npm i https://pkg.pr.new/emdash@598

create-emdash

npm i https://pkg.pr.new/create-emdash@598

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@598

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@598

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@598

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@598

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@598

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@598

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@598

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@598

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@598

commit: 3c0c804

Copy link
Copy Markdown
Collaborator

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ascorbic ascorbic merged commit 8fb93eb into emdash-cms:main Apr 16, 2026
26 checks passed
@emdashbot emdashbot bot mentioned this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cant import from WordPress sites. Any of them

2 participants